Re: Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
I am aware of this; but with too much Java still running through my brain I've never bothered with the idea yet because that's simply not the way I learned and I've never had a chance to need new attributes for singular instances. "__slots__ is not a method, so it falls outside that purpose as sta

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Alex Martelli
Peter Hansen <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Zefria <[EMAIL PROTECTED]> 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 prob

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Hansen
Alex Martelli wrote: > Zefria <[EMAIL PROTECTED]> 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 numbe

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
Dennis Lee Bieber wrote: > On Mon, 20 Feb 2006 12:44:49 +0100, Peter Otten <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> >> I have 256K, by the way. >> > Ouch... I pray it is not running some variation of Windows... (My > TRS-80 Model III/4 [upgraded motherboard, sam

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Peter Otten wrote: > > > He could be working on a machine with < 1M RAM or some other > > > constraints. > > > > I have 256K, by the way. > > > Impressive, curious to know what kind of environment it is as it has > been a long time I have seen such limited spec. My fir

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Alex Martelli
Zefria <[EMAIL PROTECTED]> 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,

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Peter Otten wrote: > >>>He could be working on a machine with < 1M RAM or some other >>>constraints. >> >>I have 256K, by the way. >> > > Impressive, curious to know what kind of environment it is as it has > been a long time I have seen such limited spec. My first x86(

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
Zefria wrote: > Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM > used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd > prefer not to see things slipping into Swap space if I can avoid it, > and the fighter data would be only part of a larger program. > > And

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > > Peter Otten wrote: >> > He could be working on a machine with < 1M RAM or some other >> > constraints. >> >> I have 256K, by the way. >> > Impressive, curious to know what kind of environment it is as it has > been a long time I have seen such limited spec. My first x

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Peter Otten wrote: > > He could be working on a machine with < 1M RAM or some other > > constraints. > > I have 256K, by the way. > Impressive, curious to know what kind of environment it is as it has been a long time I have seen such limited spec. My first x86(IBM PC) had more than that. -- htt

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Steven D'Aprano
On Mon, 20 Feb 2006 01:14:20 -0800, Zefria wrote: class Fighter(object): > ... '''Small one man craft that can only harm other fighters on > their own.''' > ... __slots__ = ["fuel","life","armor","weapon","bulk"] > ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): > ...

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > > Zefria wrote: >> Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM >> used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd >> prefer not to see things slipping into Swap space if I can avoid it, >> and the fighter data would be only

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Zefria wrote: > Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM > used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd > prefer not to see things slipping into Swap space if I can avoid it, > and the fighter data would be only part of a larger program. > > And

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
Well, my computer tends to run at about 497 to 501 out of 504 MB of RAM used once I start up Gnome, XMMS, and a few Firefox tabs, and I'd prefer not to see things slipping into Swap space if I can avoid it, and the fighter data would be only part of a larger program. And as I said, learning how to

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Zefria wrote: > Also, I don't generally do any optimization at all yet (as a highschool > student projects get trashed often enough no to bother over), but in > this special case I'm expecting each "carrier" to have up to 150 > fighters, and 3 to 5 carriers for each of the

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Peter Otten wrote: > Zefria wrote: > > > Also, I don't generally do any optimization at all yet (as a highschool > > student projects get trashed often enough no to bother over), but in > > this special case I'm expecting each "carrier" to have up to 150 > > fighters, and 3 to 5 carriers for each

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Peter Otten
Zefria wrote: > Also, I don't generally do any optimization at all yet (as a highschool > student projects get trashed often enough no to bother over), but in > 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 >

Re: Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
>>> class Fighter(object): ... '''Small one man craft that can only harm other fighters on their own.''' ... __slots__ = ["fuel","life","armor","weapon","bulk"] ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): ... self.fuel = statsTuple[0] ... self.life = stat

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bruno at modulix
Zefria wrote: class Fighter: Old-style classes are deprecated, use new-style class wherever possible: class Fighter(object): > ... '''Small one man craft that can only harm other fighters on > their own.''' > ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): > ...

Re: Quesion about the proper use of __slots__

2006-02-20 Thread bonono
Zefria wrote: > >>> class Fighter: > ... '''Small one man craft that can only harm other fighters on > their own.''' > ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): > ... self.fuel = statsTuple[0] > ... self.life = statsTuple[1] > ... self.armor =

Quesion about the proper use of __slots__

2006-02-20 Thread Zefria
>>> class Fighter: ... '''Small one man craft that can only harm other fighters on their own.''' ... def __init__(self,statsTuple=(50,5,0,(2,4),1)): ... self.fuel = statsTuple[0] ... self.life = statsTuple[1] ... self.armor = statsTuple[2] ...