Not Possible to Reference self in a Method Declaration?

Posted by phasetwenty on Stack Overflow See other posts from Stack Overflow or by phasetwenty
Published on 2010-04-05T17:59:25Z Indexed on 2010/04/05 18:03 UTC
Read the original article Hit count: 175

Filed under:

I wanted to write a method with an argument that defaults to a member variable like so:

def method(self, arg1=0, arg2=self.member):

Apparently this is not allowed. Should I write it a different way, or perhaps use a value of arg2 to signal when to use a different value?

© Stack Overflow or respective owner

Related posts about python