Re: Default parameter for a method

2008-04-16 Thread George Sakkis
On Apr 16, 4:21 pm, John Nagle <[EMAIL PROTECTED]> wrote: > In general, default values should be immutable constants only. This is more restrictive than necessary; it should rather read "In general, default values should be *treated as* immutable objects only". It's perfectly fine for a default v

Re: Default parameter for a method

2008-04-16 Thread Terry Reedy
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | [EMAIL PROTECTED] wrote: | > I wanted to know if there's any way to create a method that takes a | > default parameter, and that parameter's default value is the return | > value of another method of the same class. For ex

Re: Default parameter for a method

2008-04-16 Thread John Nagle
[EMAIL PROTECTED] wrote: > I wanted to know if there's any way to create a method that takes a > default parameter, and that parameter's default value is the return > value of another method of the same class. For example: > ... > > def meth2(self, arg=meth1()): Not good. If the defaul

Re: Default parameter for a method

2008-04-16 Thread Peter Otten
Cliff Wells wrote: > > On Wed, 2008-04-16 at 13:47 -0500, Larry Bates wrote: >> [EMAIL PROTECTED] wrote: >> > I wanted to know if there's any way to create a method that takes a >> > default parameter, and that parameter's default value is the return >> > value of another method of the same class

Re: Default parameter for a method

2008-04-16 Thread Cliff Wells
On Wed, 2008-04-16 at 13:47 -0500, Larry Bates wrote: > [EMAIL PROTECTED] wrote: > > I wanted to know if there's any way to create a method that takes a > > default parameter, and that parameter's default value is the return > > value of another method of the same class. For example: > > > > clas

Re: Default parameter for a method

2008-04-16 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I wanted to know if there's any way to create a method that takes a > default parameter, and that parameter's default value is the return > value of another method of the same class. For example: > > class A: > def __init__(self): > self.x = 1 > > def me

Re: Default parameter for a method... again

2008-04-16 Thread Matimus
On Apr 16, 9:26 am, [EMAIL PROTECTED] wrote: > I had posted this before but all the spam whipped it out... > > I wanted to know if there's any way to create a method that takes a > default parameter, and that parameter's default value is the return > value of another method of the same class. For e

Default parameter for a method... again

2008-04-16 Thread s0suk3
I had posted this before but all the spam whipped it out... I wanted to know if there's any way to create a method that takes a default parameter, and that parameter's default value is the return value of another method of the same class. For example: class A: def __init__(self): self

Default parameter for a method

2008-04-16 Thread s0suk3
I wanted to know if there's any way to create a method that takes a default parameter, and that parameter's default value is the return value of another method of the same class. For example: class A: def __init__(self): self.x = 1 def meth1(self): return self.x def m