>>> a=[42,421] >>> a.foo="bar" Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'list' object has no attribute 'foo' >>> a.__dict__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'list' object has no attribute '__dict__' >>> So, i was wondering : -- why this behaviour ? -- where the official documentation refers to this point ? -- http://mail.python.org/mailman/listinfo/python-list
I realize that built-in types objects don't provide a __dict__ attribute
and thereby i can't set an attribute to a such object, for instance
- __dict__ attribute for built-in types candide
- Re: __dict__ attribute for built-in types Arnaud Delobelle
- Re: __dict__ attribute for built-in types Duncan Booth
- Re: __dict__ attribute for built-in types Chris Angelico
- Re: __dict__ attribute for built-in types candide
- Re: __dict__ attribute for built-in types Amirouche Boubekki
- Re: __dict__ attribute for built-in types Steven D'Aprano
- Re: __dict__ attribute for built-in ty... candide
- Re: __dict__ attribute for built-... Terry Reedy
- Re: __dict__ attribute for built-... alex23
- Re: __dict__ attribute for built-... Steven D'Aprano