[triangle-zpug] static list in python

Philip Semanchuk philip at semanchuk.com
Fri Mar 14 17:29:52 UTC 2008

On Mar 14, 2008, at 12:39 PM, Josh Johnson wrote:

> I guess a global isn't so bad, it's only really global to your  
> package.

I agree; that's the rationalization I use for using globals as  
statics. =)

> There has to be some definitive answer.

I don't mean to be argumentative, but I'm not sure there is. Some  
features clearly defined in other languages become a matter of idiom  
in Python. Idiom is often a matter of taste, and therefore not  
definitive. A good example is the use of _foo and __foo as rough  
analogs to "protected" and "private" in classes. Some people think it  
is a bad idea, some like it, some (like Yours Truly) don't apply it  
as consistently as they might. In that example there's no definitive  
answer despite a lot of discussion on the topic.

Just a different perspective.


> Joseph Mack NA3T wrote:
>> On Fri, 14 Mar 2008, Josh Johnson wrote:
>>> I recall two meanings for static in programming. Static can mean a
>>> persistent value, like an internal counter in a list (I think that's
>>> what you want),
>> yes
>>> but I've also heard the term mean "a class method that
>>> is accessed like a library instead of an instance method".
>> sorry, forgot about this (I guess "static" is overloaded).
>>> I'm not sure if python supports the sort of persistent variable I  
>>> think
>>> you want (anybody else know?). If not, you may have to start with  
>>> a list
>>> and have that list be returned by your function and then  
>>> subsequently
>>> passed to it again:
>> This doesn't seem a whole lot different to just having l being  
>> global,
>> which is what I'm doing for the moment.
>> Thanks Joe
> _______________________________________________
> triangle-zpug mailing list
> triangle-zpug at starship.python.net
> http://starship.python.net/mailman/listinfo/triangle-zpug

More information about the triangle-zpug mailing list