[Python-ideas] Different interface for namedtuple?

Raymond Hettinger raymond.hettinger at gmail.com
Sat Mar 5 06:02:02 CET 2011


On Mar 4, 2011, at 8:24 PM, Carl M. Johnson wrote:

>  Imagine if the interfaces for NamedTuple and
> Table were:
> 
> make NamedTuple(rename=True) Point:
>    x, y
> 
> make Table() Author:
>    firstname, lastname, DOB = Str(), Str(), Date()


To my eyes, that doesn't even look like Python anymore.
It looks a little bit like a function annotation that lost its "->"

I think this thread has completely lost perspective.
The problem being solved is just a minor inelegance
in the signature of a factory function.  That signature
would be substantially the same in most commonly
used languages.   It's not a deep problem crying out
for a syntactic atrocity to solve it.


Raymond


P.S.  Its "namedtuple" not NamedTuple.  The latter suggests
a class rather than a factory function.    




More information about the Python-ideas mailing list