On Mon, Jun 13, 2005 at 03:52:14PM +0200, Xavier D�coret wrote:
> In other word, I would like to be able to use a=5 instead of a.set(5)
If a(5) is acceptable to you in stead of a=5
you can make your instance callable with the __call__ method:
class A(object):
def __init__(self):
self.var=0
def __call__(self,val=None):
self.var=val
a = A()
a(5)
print a.var # gives 5
egbert
--
Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991
========================================================================
--
http://mail.python.org/mailman/listinfo/python-list