[Python-Dev] namedtuple implementation grumble

Antoine Pitrou antoine at python.org
Mon Jun 9 01:32:11 CEST 2014


Le 08/06/2014 18:44, R. David Murray a écrit :
>
> For what it is worth, I found the discussion I was remembering:
>
>      http://bugs.python.org/issue7796
>
> And as someone pointed out down thread, the actual check is "inherits
> from tuple and has a _fields attribute".
>
> That gets you a duck type, which is generally what you want in Python.

I think it's a bit complicated (and not obviously discoverable) as far 
as duck-typing goes.

Regards

Antoine.




More information about the Python-Dev mailing list