Is this function attribute weirdness a feature or bug?
Erik Max Francis
max at alcyone.com
Fri Aug 17 23:36:54 EDT 2001
Roy Katz wrote:
> I am using Python 2.2a1. This works ok:
>
> def f(): pass
> f.att = 3
>
> HOWEVER--this:
>
> class C:
> def g(): pass
>
> C.g.att = 3
>
> yields:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: read-only attribute: att
The former is a function (which supports function attributes). The
latter is a method, which is a beast of a different color.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Nobody's interested in sweetness and light.
\__/ Hedda Hopper
Alcyone Systems / http://www.alcyone.com/
Alcyone Systems, San Jose, California.
More information about the Python-list
mailing list