Possible to tack on random stuff to objects?

Cruxic cruxic at gmail.com
Tue Feb 12 00:02:45 EST 2008


Is it possible to tack on arbitrary attributes to a python object?
For example:

s = 'nice 2 meet you'
s.isFriendly = True

In the above example Python complains on the second line with:

AttributeError: 'str' object has no attribute 'isFriendly'

Is there another way?



More information about the Python-list mailing list