New statement proposal for Python

Tim Peters tim at digicool.com
Tue Jun 19 15:30:14 EDT 2001


[Greg Ewing]
> ... I think there's another issue related to this: sometimes
> I'm discouraged from using named values like this because of
> the relative inefficiency of looking up globals as opposed to
> locals.
>
> Having a "const" syntax would be one way of addressing
> this, since the compiler would have opportunities to
> optimise.

I'm afraid "making opportunities" isn't that helpful unless they come with
working code to exploit them.

> Instead of introducing a new syntax, however, I'd rather
> see some work done on the implementation of module
> namespaces to make them more like local namespaces
> are now -- i.e. so that names the compiler knows about
> are accessed by indexing into an array instead of
> looking up a dictionary.
>
> I think this would be a much more worthwhile investment
> of effort, since it would benefit *all* accesses to
> globals, not just "constant" ones!

I agree.  Jeremy was looking into this seriously, but the month he intended
to work on it got lost when paternity leave came a month earlier than
planned.  So, blame God or not, but there's no bandwidth at PythonLabs to
look into this now.  Would still make a good PEP.





More information about the Python-list mailing list