private variables/methods
Alex Martelli
aleax at aleax.it
Tue Oct 14 13:07:41 EDT 2003
Mel Wilson wrote:
> In article <Iseib.204801$hE5.6891483 at news1.tin.it>,
> Alex Martelli <aleaxit at yahoo.com> wrote:
>>Terry Reedy wrote:
>>>> I think that __current_module__ is perhaps a bit too lengthy
>>>
>>> and redundant ;-)
>>
>>I disagree. Lengthy it may be, but we do want a 'reserved module
>>name' to use for this purpose.
>
> To me, the existence of a qualified
>
> __current_module__.xyz = 3
>
> implies that another local variable can also be called xyz.
> So we're forced to code things like
>
> __current_module__.xyz = 1 - __current_module__.xyz
>
> even with all the beautification brackets '__', this starts
> to look cumbersome to me. I would also prefer (while we're
you can of course use all normal possibilities of import, e.g:
import __current_module__ as g
g.xyz = 1 - g.xyz
> Maybe Python 3 could re-cast the 'global' keyword to take
> the place of '__current_module__'. 'module' might be more
> meaningful, if it doesn't ultimately take one too many
> useful names away from the programmers.
You can use any identifier you please after the 'as'.
Alex
More information about the Python-list
mailing list