Python not that wierd

Steve Lamb grey at despair.rpglink.com
Wed Aug 2 11:01:34 EDT 2000


On 2 Aug 2000 09:17:28 GMT, Martijn Faassen <m.faassen at vet.uu.nl> wrote:
>Note that if you are fine about the defaults being per class instead of
>per instance, you can set the defaults per class instead. I.e. the
>difference between:

[Snip good discussion on __init__ vs. other.

>The advantage of using class defaults is that they take up a bit less
>memory as they're shared by the instances.

    Good points.  I am doing it per __init__ just to be cleaner about it since
I don't know what other purposes I'll put the class to.  Right now I'm fairly
certain that I'll only have a single instance but I have an eye for
resuability where I might have multiple instances and want separate defaults
in each.  IRC game server of some sorts, for example.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list