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/2010-November/106109.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlib [Python-Dev] constant/enum type in stdlibRob Cliffe rob.cliffe at btinternet.com
Sun Nov 28 02:07:08 CET 2010
On 28/11/2010 21:23, Greg Ewing wrote:
> Rob Cliffe wrote:
>
>> But couldn't they be presented to the Python programmer as a single 
>> type, with the implementation details hidden "under the hood"?
>
> Not in CPython, because tuple items are kept in the same block
> of memory as the object header. Because CPython can't move
> objects, this means that the size of the tuple must be known
> when the object is created.
>
But when a frozen list a.k.a. tuple would be created - either directly, 
or by setting a list's mutable flag to False which would really turn it 
into a tuple - the size *would* be known.  And since the object would 
now be immutable, there would be no requirement for its size to change.  
(My idea doesn't require additional functionality, just a different API.)
Rob Cliffe
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