Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] namedtuple implementation grumble

Antoine Pitrouantoine at python.org
Mon Jun 9 13:40:41 CEST 2014


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?RegardsAntoine.


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp