Possible to tack on random stuff to objects?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cruxic

    Possible to tack on random stuff to objects?

    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?
Working...