A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/066429.html below:

[Python-Dev] Switch statement

[Python-Dev] Switch statement [Python-Dev] Switch statementGuido van Rossum guido at python.org
Fri Jun 23 19:23:29 CEST 2006
On 6/23/06, Alex Martelli <aleaxit at gmail.com> wrote:
> On 6/22/06, Guido van Rossum <guido at python.org> wrote:
> > Independent from this, I wonder if we also need static names of the form
> >
> >   static <name> = <expression>
> >
> > which would be similar to
> >
> >   <name> = static (<expression>)
> >
> > but also prevents <name> from being assigned to elsewhere in the same scope.
>
> Lovely!!!  Definitely +1.  Could perhaps THIS use of static be allowed
> even outside of a def?  I'd just love to have such static names in
> modules and classes, too (with runtime checks of errant assignments,
> if needed).

It would provide no speed advantage, and I don't see how the
staticness would be transferred upon import into another module.
Runtime checks of errant assignments would be relatively easy: trap
this in the module setattr operation, and henceforth let
module.__dict__ return a read-only dict wrapper. (Except that would
break "exec E in globals()". I guess it would have to be a dict
wrapper that only makes those specific keys read-only...)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4