Steven Bethard wrote:
> Andrew Jaffe wrote:
>
> I'm not sure if I understand your goal here, but you can get different
> behavior using super().
>
> py> class sup(object):
> ... cvar1 = None
> ... cvar2 = None
> ... @classmethod
> ... def setcvar1(cls, val):
> ... cls.cva
Andrew Jaffe wrote:
> Hi,
>
> I have a class with various class-level variables which are used to
> store global state information for all instances of a class. These are
> set by a classmethod as in the following (in reality the setcvar method
> is more complicated than this!):
>
> class sup
Andrew Jaffe wrote:
> Hi,
>
> I have a class with various class-level variables which are used to
> store global state information for all instances of a class. These are
> set by a classmethod as in the following (in reality the setcvar method
> is more complicated than this!):
>
> class sup(
Steve Holden wrote:
[...]
>
> I think so. It's not normal adive, but it sounds like a metaclass might
> be what you need here.
>
^adive^advice^
spell-me-own-name-wrong-next-ly y'rs - evest
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb
Andrew Jaffe wrote:
> Steve Holden wrote:
>
>>Andrew Jaffe wrote:
>>
>>>Steve Holden wrote:
>>>
Andrew Jaffe wrote:
>The problem is that I actually do want to call these methods on the
>class itself, before I've made any instances.
>
Except you could use staticm
Steve Holden wrote:
> Andrew Jaffe wrote:
>> Steve Holden wrote:
>>> Andrew Jaffe wrote:
>>>
The problem is that I actually do want to call these methods on the
class itself, before I've made any instances.
>>> Except you could use staticmethods with an explicit class argument ...
>
Andrew Jaffe wrote:
> Steve Holden wrote:
>
>>Andrew Jaffe wrote:
>>
>>
>>>The problem is that I actually do want to call these methods on the
>>>class itself, before I've made any instances.
>>>
>>
>>Except you could use staticmethods with an explicit class argument ...
>
>
> Steve,
>
> Yep,
Steve Holden wrote:
> Andrew Jaffe wrote:
>
>>The problem is that I actually do want to call these methods on the
>>class itself, before I've made any instances.
>>
> Except you could use staticmethods with an explicit class argument ...
Steve,
Yep, that would work! Thanks.
But it does seem li
Andrew Jaffe wrote:
>>Andrew Jaffe wrote:
[...]
>
> The problem is that I actually do want to call these methods on the
> class itself, before I've made any instances.
>
Except you could use staticmethods with an explicit class argument ...
regards
Steve
--
Steve Holden +44 150 684 725
Andrew Jaffe wrote:
>>Andrew Jaffe wrote:
>>
>>
>>>Hi,
>>>
>>>I have a class with various class-level variables which are used to
>>>store global state information for all instances of a class. These are
>>>set by a classmethod as in the following
>>>
>>>class sup(object):
>>> cvar1 = None
>>
> Andrew Jaffe wrote:
>
>> Hi,
>>
>> I have a class with various class-level variables which are used to
>> store global state information for all instances of a class. These are
>> set by a classmethod as in the following
>>
>> class sup(object):
>> cvar1 = None
>> cvar2 = None
>>
>>
Andrew Jaffe wrote:
> Hi,
>
> I have a class with various class-level variables which are used to
> store global state information for all instances of a class. These are
> set by a classmethod as in the following (in reality the setcvar method
> is more complicated than this!):
>
> class sup(
Hi,
I have a class with various class-level variables which are used to
store global state information for all instances of a class. These are
set by a classmethod as in the following (in reality the setcvar method
is more complicated than this!):
class sup(object):
cvar1 = None
cvar
13 matches
Mail list logo