Le 09/06/2014 00:05, Raymond Hettinger a écrit :

Another issue is that a straight abc wouldn't be sufficient.  What we
would really want is to check for is:
1) the presence of a _fields tuple (an abc can do this)
2) to check that all of the attribute names specified in _fields are
defined (ABCMeta doesn't do this)
3) and that the type is a Sequence (ABCMeta can do this).

An tricked-out ABC extension might be worth it if it provided some
non-trivial mixin capabilities for implementing homegrown named tuples
(not created by the factory function), but I don't think we want to go
there.

Instead of an ABC, why not a simple is_namedtuple() function?

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to