Brian Munroe a écrit :
On Sep 2, 3:33 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
In a nutshell, like all double-underscore methods, __setattr__ are for
overriding behaviour in your own classes. With very few exceptions, you
shouldn't need to directly call
On Sep 3, 6:34 am, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
The underscore versions are for customizing the lookup process, not for
dynamically looking up names. If your class needs to do something non-
standard when you write obj.name, you might need to write methods
Hi,
Sorry if the subject line of post is wrong, but I think that is what
this is called. I want to create objects with
class Coconuts(object):
def __init__(self, a, b, *args, **kwargs):
self.a = a
self.b = b
def spam( l )
return Coconuts( l.a, l.b, l.attributes )
l in a
Nathan Harmston [EMAIL PROTECTED] wrote:
Hi,
Sorry if the subject line of post is wrong, but I think that is what
this is called. I want to create objects with
class Coconuts(object):
def __init__(self, a, b, *args, **kwargs):
self.a = a
self.b = b
def spam( l )
On Sep 2, 11:46 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
If you want to pass the attributes list it's simpler to do that
directly, avoiding *a and **k constructs. E.g.:
def __init__(self, a, b, attrs):
self.a = a
self.b = b
for attr in attrs:
name, value =
On Sun, 02 Sep 2007 21:41:43 +, Brian Munroe wrote:
One question though, which I haven't been able to find the answer from
scouring the internet. What is the difference between calling
__setattr__ and setattr or __getattr__ and getattr, for that matter?
Have you read the following?
#
On Sep 2, 3:33 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
In a nutshell, like all double-underscore methods, __setattr__ are for
overriding behaviour in your own classes. With very few exceptions, you
shouldn't need to directly call double-underscore methods (although you