-1

So if I do something like:

>>> s ='abc'
>>> it = iter(s)
>>> print(it)
<str_iterator object at 0x10543eac8>

or:

>>> s = 'abc'
>>> it = iter(s)
>>> it
<iterator object at 0x00A1DB50>

We have in both cases the indication that "it" is an iterator (with the specification of what kind of iterator in the first example). What I am curious about is the meaning of the string that follows. 0x10543eac8 or 0x00A1DB50.

Does anyone know its meaning and/or use?

Thank you, Den

  • 1
    related https://stackoverflow.com/questions/121396/accessing-object-memory-address – qwr Dec 15 '18 at 17:04

1 Answers1

1

In CPython, it's the memory address where that object is stored, which corresponds to the value returned by id. It can be useful for debugging purposes to see whether two prints refer to the same object or not (given that, at some moment of time, at a given address can exist only a single Python object).

Matteo Italia
  • 123,740
  • 17
  • 206
  • 299