Effects of caching frequently used objects, was Re: Explaining names vs variables in Python
Albert-Jan Roskam
sjeik_appie at hotmail.com
Fri Mar 25 09:03:05 EDT 2016
> To: python-list at python.org
> From: __peter__ at web.de
> Subject: Effects of caching frequently used objects, was Re: Explaining names vs variables in Python
> Date: Wed, 2 Mar 2016 10:12:48 +0100
>
> Salvatore DI DIO wrote:
>
> > Hello,
> >
> > I know Python does not have variables, but names.
> > Multiple names cant then be bound to the same objects.
> >
> > So this behavior
> >
> >>>> b = 234
> >>>> v = 234
> >>>> b is v
> > True
> >
> > according to the above that is ok
> >
> >
> >
> > But where is the consistency ? if I try :
> >
> >>>> v = 890
> >>>> w = 890
> >>>> v is w
> > False
> >
> > It is a little difficult to explain this behavior to a newcommer in Python
> >
> > Can someone give me the right argument to expose ?
>
> You should not bother with object identity for objects other than None.
A little late to the party, but: how about Ellipsis? Shouldn't "is" also be used for that one? (It's rare, I know :))
Albert-Jan
More information about the Python-list
mailing list