Brian Curtin <cur...@acm.org> added the comment:

The 3.x documentation[1] has this:
"object does not have a __dict__, so you can’t assign arbitrary attributes to 
an instance of the object class."
- 2.x doesn't have that same blurb -- it looks like it should.

AttributeError vs. TypeError seems to be the issue here.


FWIW, the way to achieve what you had in your example is something like this:
>>> a = type("my_type", (object,), {})
>>> a.abc = 3


[1] http://docs.python.org/3.1/library/functions.html#object

----------
nosy: +brian.curtin
stage:  -> needs patch
title: Problems with attribute assignment on object instances -> Attribute 
assignment on object() instances raises wrong exception
versions: +Python 2.7

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

Reply via email to