(why) inconsistent yield/return syntax?
Gerrit Holl
gerrit at nl.linux.org
Mon Feb 10 15:41:32 EST 2003
Mark McEahern schreef op maandag 10 februari om 21:32:46 +0000:
> > Subject: (why) inconsistent yield/return syntax?
>
> yield is for generators.
>
> To use it prior to 2.3 (?), add:
>
> from __future__ import generators
>
> Read up on generators. Google is your friend.
I have.
If if wouldn't have done that, it would be:
1 >>> def f(): yield
<stdin>:1: Warning: 'yield' will become a reserved keyword in the future
But it was:
46 >>> def f(): yield
File "<stdin>", line 1
def f(): yield
yours,
gerrit.
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/
More information about the Python-list
mailing list