A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-April/044469.html below:

Treating Builtins as Constants inthe Standard Library

[Python-Dev] PEP 329: Treating Builtins as Constants inthe Standard LibraryPhillip J. Eby pje at telecommunity.com
Tue Apr 20 12:01:04 EDT 2004
At 11:33 AM 4/20/04 -0400, Andrew Koenig wrote:
> > You could, of course, create a statement like "const len" to flag that
> > len will NOT be changed, thus creating true backwards compatibility,
>
>Somehow this idea is getting tangled in my mind with the distinction between
>mutable and immutable objects.  When you use an object as a dict key, it
>must not change, in order to allow the optimization that keys can be sought
>through hashing rather than by sequential search.  Similarly, making a name
>such as True immutable allows the optimization that "while True:" can be
>determined during compilation to be unconditional.
>
>I understand that there is a difference between the kinds of immutability,
>but still there seems to be a strong connection here.

I think it's a bad idea to confuse a read-only name binding, and the 
concept of an immutable object.  They aren't the same thing, although the 
former can be implemented by a namespace that is the latter.


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