On Mon, Jan 23, 2017 at 12:49 PM, Chris Angelico <ros...@gmail.com> wrote:
>
> On Tue, Jan 24, 2017 at 4:49 AM, Sourabh Kalal <kalalsun...@gmail.com> wrote:
> > how we can access the value from using id..
> > like x=10
> > id(x)
> > 3235346364
> >
> > how i can read value 10 using id 3235346364
>
> No, you can't. That isn't a memory address - it's just a unique
> identifier. Python doesn't have memory addresses.

Well, it might be, but that would be very implementation-dependent.
Any attempt to treat an id as a memory address and interpret the
object at that address as the beginning of a PyObject of any kind will
be fragile in the extreme. Even if you have two different
implementations at hand which both use memory addresses as convenient
ids, there's no guarantee that the address represents that start of a
CPython PyObject.

>>> hex(3235346364)
'0xc0d777bc'

There. *Now* you have an address. Hack to your heart's content. <wink>

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to