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
"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
[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
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
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
[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
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
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
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