[Python-Dev] PEP 380 (yield from a subgenerator) comments
Nick Coghlan
ncoghlan at gmail.com
Thu Mar 26 10:19:41 CET 2009
Greg Ewing wrote:
> Nick Coghlan wrote:
>
>> Although the PEP may still want to mention how one would write *tests*
>> for these things. Will the test drivers themselves need to be generators
>> participating in some kind of trampoline setup?
>
> I don't see that tests are fundamentally different
> from any other code that wants to call a value-returning
> generator and get the value without becoming a generator
> itself. So if it's to be mentioned in the PEP at all,
> a general solution might as well be given (whether it's
> to use a trampoline or just write the necessary next()
> and except code).
Agreed the problem is more general than just testing - but a test driver
is potentially interesting in that you probably want the same test suite
to be able to test both normal code and the cooperative multitasking code.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev
mailing list