class variables

Aahz Maruch aahz at netcom.com
Fri Mar 10 15:27:26 EST 2000


In article <38C8C4DA.24E63F4 at ALCATEL.de>,  <T.Rafie at ALCATEL.de> wrote:
>
>In C++ one can use static variables as class variables on which You
>have access from different instances of the class.  How can that be
>realized in Python?  Think for example on a singleton-class which
>should have only one instance.

Oleg answered your question; now I'm going to answer the question you
didn't ask (yet): while class variables in Python are reasonably
straightforward, there are no class *methods* in Python.  You need to
have an instance, access the class variables directly, or create a
module-level function.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Along the lines of getting a massage, taking a hot bubble bath, and
swimming in a pool of warm, melted chocolate, can you give me some
innovative ways that you pamper yourself?"
"Spend three hours flaming stupid people on the Net."  --Aahz



More information about the Python-list mailing list