Bugs item #1687163, was opened at 2007-03-23 16:51
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1687163&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Nobody/Anonymous (nobody)
Summary: Inconsistent Exceptions for Readonly Attributes

Initial Comment:
Attempting assignment to a readonly attribute raises an Attribute error for 
pure Python attributes but raises a TypeError for C readonly attributes.  I 
think the AttributeError is the correct exception.



>>> class A(object):
...     _x = []
...
...     @property
...     def x(self):
...             return self._x
...     
>>> a = A()
>>> a.x = None

Traceback (most recent call last):
    a.x = None
AttributeError: can't set attribute




>>> def f():
...     yield None
>>> g = f()
>>> g.gi_frame = None

Traceback (most recent call last):
    g.gi_frame = None
TypeError: readonly attribute

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1687163&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to