Nathan Duran wrote: > > On Apr 11, 2008, at 11:35 AM, [EMAIL PROTECTED] wrote: >> I'd like to assign the value of an attribute in __init__ as the default >> value of an argument in a method. See below: > Why not just do > > def franklin(self, keyword): > if not keyword: keyword = self.default > return "A %s in time saves nine." % (keyword)
Several things are false (for example: '', 0, False, [], ...) If you can get along with the code you have suggested, I'd think about using: def franklin(self, keyword): return "A %s in time saves nine." % (keyword or self.default) -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list