Hi,
I can do
tuple([1,2,3])
but not:
from collections import namedtuple
namedtuple('B', 'x y z')([1,2,3])
I get a TypeError: __new__() takes exactly 4 arguments (2 given)
However I can do:
namedtuple('B', 'x y z')._make([1,2,3])
So namedtuple's _make classmethod looks a lot like tuple's __new__().
What's the rationale for this? Wouldn't it be better to share the same
signature for __new__?
IPython's serialization code depends on a tuple's __new__() having the
signature that tuple has and therefore does not work with namedtuples.
See discussion here:
http://article.gmane.org/gmane.comp.python.general/726849
Thanks,
John.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com