Re: Terminology: “reference” versus “pointer”
rosuav at gmail.com
Sat Sep 12 08:31:16 CEST 2015
On Sat, Sep 12, 2015 at 4:26 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> If you do agree with those, some corollaries follow:
> * Container types do not contain objects.
> It is a useful analogy to say the objects are “in” the container; but
> that would imply they are not simultaneously in any other container.
> That's not true, so it's a flawed (though very useful) analogy.
It's so useful that we have an operator called "in", implemented using
a magic method "__contains__", to test exactly that concept. As long
as you understand that containment here really means something more
like "is accessible from", it's correct. Flawed in a minor way, but so
extremely convenient that it's not worth going for complete technical
More information about the Python-list