On Thu, 18 Jan 2007 03:58:22 -0800, 0k- wrote:
> hello!
>
> i started to write a game in python in which i want to implement
> "dynamically attachable" attributes.
All attributes in Python are dynamically attachable.
>>> class Parrot:
... pass
...
>>> p = Parrot()
>>> hasattr(p, "plumage")
thanks for the quick reply, Peter! :)
--
http://mail.python.org/mailman/listinfo/python-list
0k- wrote:
> class Thing(object):
> props = {}
> def __init__(self):
> self.props["text"] = TxtAttr("something important")
>
> t1 = Thing()
> t2 = Thing()
>
> t2.props["text"].value = "another string"
>
> print "t1: %s\nt2: %s" % (t1.props["text"].value,
> t2.props["text"].value
oops, i forgot to mention i'm using interpreter version 2.4.3
--
http://mail.python.org/mailman/listinfo/python-list
hello!
i started to write a game in python in which i want to implement
"dynamically attachable" attributes.
my intention is to generalise this and moreover these attributes can be
complex, so i'm creating classes to represent these attributes. but
somehow i cannot instantiate these attribute clas