a is b

jitendra gupta jitu.icfai at gmail.com
Thu Nov 5 01:29:50 EST 2009


Hi Sebas

>>> w = "q"
>>>a = "q"
>>>id(w)
11160864
>>>id(a)
11160864
>>> z = "big string"
>>> s = "big string"
>>> id(z)
13675120
>>> id(s)
13674520
This is applicable for number also.. , python caches is using same id for
small numbers and string.

Jitendra Kumar

On Thu, Nov 5, 2009 at 12:12 AM, Chris Rebert <clp2 at rebertia.com> wrote:

> On Wed, Nov 4, 2009 at 10:37 AM, Sebastian <sebas0 at gmail.com> wrote:
> > 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?
>
> See recent thread on the subject:
> http://www.mail-archive.com/python-list@python.org/msg264434.html
>
> Cheers,
> Chris
> --
> http://blog.rebertia.com
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091105/5bffd835/attachment-0001.html>


More information about the Python-list mailing list