[Python-Dev] iterators and extended function call syntax (WAS: Replacement for print in Python 3.0)
steven.bethard at gmail.com
Sat Sep 3 19:06:48 CEST 2005
Nick Coghlan wrote:
> I actually hope that extended function call syntax in Py3k will
> use iterators rather than tuples so that this problem goes away.
I suggested this a while back on the Python list:
Raymond Hettinger brought up a few pretty valid complaints, the
biggest of which is that a lot of code now expects *args to be
sequences, not iterators. For example, the code you posted on the
Wiki would break:
def write(*args, **kwds):
# may break if args iterator does not have a __len__
if not args:
# will break unless "args = tuple(args)" precedes it
for arg in args[1:]:
This code would have to be rewritten to use the iterator's .next()
method and try/excepts for StopIterations. It's not particularly
hard, but people would have to do some relearning about *args.
You can wordify anything if you just verb it.
--- Bucky Katt, Get Fuzzy
More information about the Python-Dev