Skip to content

generator-based exercises are rough #4

@parmentelat

Description

@parmentelat

release 0.6 comes with an experimental model for building generator-based exercises

we have 2 different and complementary mechanisms to limit / select output from the generator flow

  • max_iterations is set on the exercise instance; it acts more like an antiloop, and allows to limit the amount of iterations done no matter what
  • islice is set on the GeneratorArgs object and allows to select only a selection of the flow; designed to inspect for example the 1000-th iteration, within the same exercise and same actual parameters passed to the gen-func

within 0.6.0 these 2 mechanisms do not cohabit very nicely; when testing primes() with max_iterations=10_000 everything becomes super-slow
the point is that we need to call list() on the generator output rather early in the process - so that comparisons do the right thing - and it is very likely the point where things go wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions