Newbie asks about static variables...
Stefan Franke
spamfranke at bigfoot.de
Thu May 6 07:43:50 EDT 1999
On Thu, 06 May 1999 10:06:33 +0200, Martijn Faassen <faassen at pop.vet.uu.nl>
wrote:
>A global variable _foo indeed isn't imported if you do a
>'from module import *'. But it's perfectly possible to do 'import
>module; print module._foo', it turns out to my surprise! This seems to
>me rather inconsistent behavior; is there a reason why this is so?
AFAIK the leading underscore convention was introduced exactly
for the reason to avoid namespace pollution when doing a 'from
module import * ', not as a kind of access control, like the two
leading underscores inside class definitions.
Stefan
More information about the Python-list
mailing list