Function mistaken for a method

Maric Michaud maric at aristote.info
Thu Jun 1 08:44:37 EDT 2006


Le Jeudi 01 Juin 2006 13:12, Eric Brunel a écrit :
> Thanks for your explanations, Peter. I'll have to find another way to do  
> what I want...

maybe :

class C:
    f = None
    def __init__(self):
      if self.f is not None:
        self.x = self.f(0)
      else:
        self.x = 0

 class C2(C):
    def __init__(self) :
	self.f = lambda x: x != 0

-- 
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097



More information about the Python-list mailing list