On Wed, 26 Sep 2001, Christian Robottom Reis wrote:
> On Sun, 23 Sep 2001, James Henstridge wrote:
>
> > Using the tp_getset stuff, you can't set the field attributes (unless a
> > setter function is given), so the second statement would probably raise an
> > read only attribute exception.
>
> Should raise an exception, sure. Not sure what exception it should raise,
> though; can't seem to find any built-in exception that would be
> appropriate; perhaps TypeError?
Python raises a TypeError when setting a read only attribute. Eg:
Python 2.2a3+ (#13, Sep 25 2001, 11:06:31)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(): pass
...
>>> f.func_name = 'hello'
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: readonly attribute
>>>
By the way, the python22-branch has replacements for everything I used
ExtensionClass for previously. Presently, it needs a recent CVS snapshot
of python 2.2 -- it won't compile with 2.2a3 due to a structure renaming,
but will work with 2.2a4 (which should be out soon).
Anyone have thoughts about merging the branch into HEAD?
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk