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
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
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
[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 meth1(self
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:
class
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
[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 default
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 example
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 value