Re: About __init__ and default arguments

2008-04-12 Thread Scott David Daniels
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

About __init__ and default arguments

2008-04-11 Thread Kevin Takacs
Hi, I'd like to assign the value of an attribute in __init__ as the default value of an argument in a method. See below: class aphorisms(): def __init__(self, keyword): self.default = keyword def franklin(self, keyword = self.default): return A %s in time saves nine. %

Re: About __init__ and default arguments

2008-04-11 Thread Steve Holden
Kevin Takacs wrote: Hi, I'd like to assign the value of an attribute in __init__ as the default value of an argument in a method. See below: class aphorisms(): def __init__(self, keyword): self.default = keyword def franklin(self, keyword = self.default):

Re: About __init__ and default arguments

2008-04-11 Thread Arnaud Delobelle
On Apr 11, 7:20 pm, Kevin Takacs [EMAIL PROTECTED] wrote: Hi, I'd like to assign the value of an attribute in __init__ as the default value of an argument in a method.  See below: class aphorisms():     def __init__(self, keyword):         self.default = keyword     def franklin(self,

Re: About __init__ and default arguments

2008-04-11 Thread Nathan Duran
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: Are you sure? You will not get fresh values with each call in Python as you would in other languages. Why not just