> > I guess because the function name may be re-bound between loop iterations. > > Are there good applications of this? I don't know.
I have iterator like objects which dynamically rebind the .next method in order to different things. When I want a potentially infinite iterator to stop, I rebind its .next method to another method which raises StopIteration. This saves lots of messy if/elif state checking in the .next method, which I _need_ to be very fast. > > Yuk I'd hate that. I think it would be extremely rare. > I use it all the time. Dynamically rebinding methods is a nice way to change and maintain state between calls. Sw. -- http://mail.python.org/mailman/listinfo/python-list