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.defaul

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 jus

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 frankl

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): >