a is b

Sebastian sebas0 at gmail.com
Wed Nov 4 13:37:39 EST 2009


I have a question from the pyar  list that may have been discussed on this
list, but i didn't catch it.
Have some common objects been somewhat hardcoded into python, like some
integers as shown in the examples below? What other object have been
hardcoded (strings ,etc) and what was the criteria used to select them?  Any
hints?
cheers,
- Seb

>>> p = 500
>>> q = 500
>>> p == q
True
>>> p is q
False
>>> n = 50
>>> m = 50
>>> n == m
True
>>> n is m
True
>>> p = 500; q = 500
>>> p is q
True

 >>> for i in range(-20,258):
...   a = i
...   b = i+0
...   if not (a is b): print i
...
-20
-19
-18
-17
-16
-15
-14
-13
-12
-11
-10
-9
-8
-7
-6
257
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091104/11844304/attachment.html>


More information about the Python-list mailing list