New submission from Pascal Chambon <chambon.pas...@gmail.com>:

It seems we can't assign attributes to "objet" class instances, which don't 
have a __dict__ :

IDLE 2.6.4      
>>> a = object()
>>> a.abc = 3

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    a.abc = 3
AttributeError: 'object' object has no attribute 'abc'
>>> 

This behaviour seems undocumented, and contradicts the documentation on 
AttributeError -> normally, a TypeError should be raised instead:

exception AttributeError
    Raised when an attribute reference (see Attribute references) or assignment 
fails. (When an object does not support attribute references or attribute 
assignments at all, TypeError is raised.)

----------
components: Interpreter Core
messages: 97416
nosy: pakal
severity: normal
status: open
title: Problems with attribute assignment on object instances
type: behavior
versions: Python 2.6

_______________________________________
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