Quesion about the proper use of __slots__

Alex Martelli aleaxit at yahoo.com
Mon Feb 20 12:12:39 EST 2006


Zefria <zefria at gmail.com> wrote:
   ...
> this special case I'm expecting each "carrier" to have up to 150
> fighters, and 3 to 5 carriers for each of the two teams, which comes
> out to be quite large.

The problem with the spread of email is that it reduces the number of
envelopes laying around, and thus makes it harder to do "back of the
envelopes" calculations (the key skill in engineering...).

With 10 carriers between the two teams, and 150 fighters/carrier, you're
dealing with 1500 fighters.  If you save 64 bytes per fighter (and I
don't think __slots__ will save quite that much), we're still talking
about less than 100,000 bytes -- peanuts.  __slots__ is unwarranted.


> Additionally, this program's purpose was to experiment with as many of
> the special methods as possible, so I suppose I'm on track so far.

__slots__ is not a method, so it falls outside that purpose as stated.


Alex



More information about the Python-list mailing list