Mark Dickinson added the comment:

Right; the underlying problem of having objects that appear to be instances of  
the wrong class has nothing to do with namedtuples.  After this sequence:

>>> class A: pass
... 
>>> a = A()
>>> 
>>> class A: pass
... 

We get the following somewhat confusing results:

>>> type(a)
<class '__main__.A'>
>>> A
<class '__main__.A'>
>>> isinstance(a, A)
False

Class factories like namedtuple make it somewhat easier to run into this issue, 
but it's nothing really to do with namedtuple itself, and it's not something 
that could be "fixed" without significant language redesign.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22563>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to