generators improvement
John Roth
newsgroups at jhrothjr.com
Tue Aug 19 12:50:10 EDT 2003
More information about the Python-list mailing list
Tue Aug 19 12:50:10 EDT 2003
- Previous message (by thread): generators improvement
- Next message (by thread): generators improvement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Duncan Booth" <duncan at NOSPAMrcp.co.uk> wrote in message news:Xns93DC5C1AFAB9Eduncanrcpcouk at 127.0.0.1... > Oleg Leschov <kalmas at udm.ru> wrote in > news:bhtiij$psc$2 at ocasysi.rubbernet.net: > > > What needs to be done is to allow yield return something - whatever was > > passed to the .next() thing from caller.. > > Easy and obvious, isn't it? So is there any principal problem with this > > idea that would prevents its implementation? > > Please read PEP 288, http://www.python.org/peps/pep-0288.html > in particular the section: > > > Rejected Alternative > > One idea for passing data into a generator was to pass an argument > > through next() and make a assignment using the yield keyword: > > > > datain = yield dataout > > . . . > > dataout = gen.next(datain) > > > > The intractable problem is that the argument to the first next() call > > has to be thrown away, because it doesn't correspond to a yield > > keyword. "I can't figure out how to do it so that it satisfies my sense of esthetics" is not the same as "this problem doesn't need to be solved." John Roth > > > > > -- > Duncan Booth duncan at rcp.co.uk > int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" > "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
- Previous message (by thread): generators improvement
- Next message (by thread): generators improvement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list