On Nov 18, 5:20 pm, Thomas Mlynarczyk <[EMAIL PROTECTED]>
wrote:
> Aaron Brady schrieb:
>
> > And, if you don't intend to use 'myway' on 'listiterator's and such,
> > 'send( None )' is equivalent to 'next( )'.
>
> I didn't know that. But doesn't that impose a restriction somehow? It
> makes it impo
Aaron Brady schrieb:
And, if you don't intend to use 'myway' on 'listiterator's and such,
'send( None )' is equivalent to 'next( )'.
I didn't know that. But doesn't that impose a restriction somehow? It
makes it impossible to send a None to a generator.
Greetings,
Thomas
--
Ce n'est pas pa
alex23 schrieb:
http://www.python.org/dev/peps/pep-0342/
That links to the original proposal to extend the generator behaviour
After some searching, I found this as a remark in parentheses:
"Introducing a new method instead of overloading next() minimizes
overhead for simple next() calls."
On Nov 16, 3:36 pm, Thomas Mlynarczyk <[EMAIL PROTECTED]>
wrote:
> Arnaud Delobelle schrieb:
>
> > If you want to simply 'set' the generator (by which I take you mean
> > 'change its state') without without iterating it one step, then what you
> > need is a class with an __iter__() method. Then yo
On Nov 17, 7:36 am, Thomas Mlynarczyk <[EMAIL PROTECTED]>
wrote:
> Still, I would like to know why it was decided to
> introduce a send() method instead of allowing an argument for next().
Hey Thomas,
A great place to gain insight into the reasoning behind changes to
Python is the PEPs:
http://w
Arnaud Delobelle schrieb:
If you want to simply 'set' the generator (by which I take you mean
'change its state') without without iterating it one step, then what you
need is a class with an __iter__() method. Then you can change the
state of the object between calls to next(). E.g.
class M
Thomas Mlynarczyk <[EMAIL PROTECTED]> writes:
> Hello,
>
> I was playing around a bit with generators using next() and
> send(). And I was wondering why an extra send() method was introduced
> instead of simply allowing an argument for next().
>
> Also, I find it a bit counter-intuitive that send(