dynamism

Mark McEahern marklists at mceahern.com
Tue Sep 10 14:27:56 CEST 2002


[Duncan Booth]
> New style classes (which are those with 'object' or other builtin classes
> as a base class) do not all allow you to add arbitrary attributes:

Au contraire:

$ python
Python 2.2.1 (#1, Jun 25 2002, 10:55:46)
[GCC 2.95.3-5 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class foo(object):pass
...
>>> f = foo()
>>> f.x = 1
>>> f.x
1
>>>

Cheers,

// m

-





More information about the Python-list mailing list