Nathan Duran wrote:
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
Scott.Daniels@A cm.Org
>
On Apr 11, 2008, at 11:35 AM, python-list-request@python. org wrote:
Why not just do
>
def franklin(self, keyword):
if not keyword: keyword = self.default
return "A %s in time saves nine." % (keyword)
On Apr 11, 2008, at 11:35 AM, python-list-request@python. org 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:
>value of an argument in a method. See below:
>
def franklin(self, keyword):
if not keyword: keyword = self.default
return "A %s in time saves nine." % (keyword)
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
Scott.Daniels@A cm.Org