[Python-3000] symbols?

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 13 04:07:51 CEST 2006


Michael Chermside wrote:

> I must
> be unusually lucky in this regard, because I meet lots of people who
> are very concerned about the fact that it *is* possible to change
> these values.

Occasionally I wonder whether it would be useful
to have some form of const declaration in the
language, not to prevent accidental change, but
so that access to them can be optimised. E.g. in

const GET = 'GET'

def f(address):
   html_fungle(address, GET)

the access to GET in the function could be
compiled into some sort of array lookup instead
of a global dict lookup.

Although if a way is found to optimise global
accesses in general, this might become unnecessary.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiam!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+


More information about the Python-3000 mailing list