What the Pythons docs means by "container" ?

Ethan Furman ethan at stoneleaf.us
Wed Feb 18 14:43:52 EST 2015


On 02/17/2015 06:14 PM, candide wrote:
> Le mercredi 18 février 2015 01:50:16 UTC+1, Chris Angelico a écrit :
> 
>>
>> So, what's a container? It's a thing that you put other objects into.
> 
> I agree with this approach. The important point to consider here is the last word in your definition : "into".

You are getting bogged down with implementation details; not even dict, list, nor tuple actually have the contained
objects inside their memory space.  What they have is a record of what objects they "contain", and methods to work with
those objects.

Whether a "contained" object exists before it is accessed is irrelevant, is an implementation detail, and is a level of
optimization.

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20150218/131082fa/attachment.sig>


More information about the Python-list mailing list