[issue13203] Doc: say id() is only useful for existing objects

2013-10-12 Thread Georg Brandl

Georg Brandl added the comment:

Suggestion attached.

--
keywords: +patch
Added file: http://bugs.python.org/file32059/id_unique.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2013-10-12 Thread Ezio Melotti

Ezio Melotti added the comment:

LGTM

+ created and deleted during execution of the ``id()``

If you want to be more accurate you could say before and after instead of 
during.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2013-10-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8525cc1f342f by Georg Brandl in branch '2.7':
Closes #13203: add a FAQ section about seemingly duplicate id()s.
http://hg.python.org/cpython/rev/8525cc1f342f

--
nosy: +python-dev
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2013-10-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0d5de993db66 by Georg Brandl in branch '3.3':
Closes #13203: add a FAQ section about seemingly duplicate id()s.
http://hg.python.org/cpython/rev/0d5de993db66

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-21 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-21 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

A FAQ entry sounds good to me.

--
nosy: +ezio.melotti
stage:  - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-17 Thread Terry J. Reedy

New submission from Terry J. Reedy tjre...@udel.edu:

Newbies too often do something like (3.2.2, )

 id(getattr(x, 'pop')) == id(x.pop)
True

and get confused by the (invalid) result, whereas

 a,b=getattr(x, 'pop'),x.pop
 id(a)==id(b)
False

works properly. I think we should add a sentence or two or three to the id() 
doc, such as

Since a newly created argument object is either destroyed or becomes 
inaccessible before the function returns, *id(obj)* is only useful and valid if 
*obj* exists prior to the call and therefore after its return.
The value of an expression such as *id(666)== id(667)* is arbitrary and 
meaningless. The id of the first int object might or might not be reused for 
the second one.

--
assignee: docs@python
components: Documentation
messages: 145743
nosy: docs@python, terry.reedy
priority: normal
severity: normal
status: open
title: Doc: say id() is only useful for existing objects
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-17 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

If we add something at all, it should be much shorter. After all, the current 
doc already states unique during its lifetime.

--
nosy: +georg.brandl, rhettinger
priority: normal - low

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-17 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I gave a maximum addition. The first sentence may be enough (or even just the 
second half of it). What people do not get is that the lifetime of new arg 
objects is the duration of the function call -- and that the output of id for 
departed objects is uniquely useless and invalid.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-17 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

I think this is over-explaining an implementation detail and it makes the docs 
for id() harder to understand.

Possibly there can be a FAQ entry about identity but the id() function itself 
is no place to go into the quirks of when new objects are created or destroyed.

Also, getting confused is often a step in the learning process -- it can't be 
taken out entirely.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13203] Doc: say id() is only useful for existing objects

2011-10-17 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13203
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com