Setting a Global Default for class construction?
Josh English
english at spiritone.com
Sat Feb 1 14:30:49 EST 2003
Lao Coon wrote:
> Josh English <english at spiritone.com> wrote in
> news:b1erj009ok at enews3.newsguy.com:
>
>
>>Here is the code that I am struggling with in a Python module:
>>
>>_Thing = "it"
>>
>>def SetThing(s):
>> global _Thing
>> _Thing = str(s)
>>
>>class NewThing:
>> def __init__(self,thing=_Thing):
>> self.Thing = _Thing
>
>
> Here you're always setting self.Thing to "it"
> you want "self.Thing = thing"..
Oops. The real code does have the equivalent of self.Thing = thing.
Sorry about that.
Josh English
english at spiritone.com
More information about the Python-list
mailing list