[Patches] [Patch #103395] Guido changed his mind! Quickly, add 'if key in dict'!

noreply@sourceforge.net noreply@sourceforge.net
Sat, 27 Jan 2001 23:18:11 -0800


Patch #103395 has been updated. 

Project: python
Category: core (C code)
Status: Open
Submitted by: twouters
Assigned to : fdrake
Summary: Guido changed his mind! Quickly, add 'if key in dict'!

Follow-Ups:

Date: 2001-Jan-27 23:18
By: tim_one

Comment:
Reviewed the code and tried it out.  Boffo!  It's Accepted as far as I'm
concerned.  Cute:  the Cygwin "patch" program core dumped consistently when
trying to apply the NEWS patch, so I didn't test that part <wink>.

Assigned to Fred for final disposition, since Thomas noted doc questions in
his comments.  I'll add that, since the docs already explain has_key,
nothing good can come of trying to explain "in" via different words; would
be shorter and better to just say

    x in dict == dict.has_key(x)
    x not in dict == not dict.has_key(x)

everywhere it comes up.

-------------------------------------------------------

Date: 2001-Jan-27 21:53
By: tim_one

Comment:
Assigned to me while Guido is sleeping so he doesn't get a chance to change
his mind.

-------------------------------------------------------

Date: 2001-Jan-27 17:26
By: twouters

Comment:
Newer patch, avoids Misc/NEWS conflict, fixes oversight in dict_contains.


-------------------------------------------------------

Date: 2001-Jan-24 01:05
By: tim_one

Comment:
There must be something in the air, besides email delays.  I'll take your
word for it that Guido changed his mind, but I was about to say +1 anyway! 
Now all we have to do is trick xreadlines into iterating over dicts
<wink>.

-------------------------------------------------------

Date: 2001-Jan-23 23:39
By: twouters

Comment:
Added testcases for dict and UserDict.

-------------------------------------------------------

Date: 2001-Jan-23 23:20
By: twouters

Comment:
Add some docs (not guarded by a 'new in 2.1' statement, I don't know how to
do that), NEWS item and support in UserDict.UserDict. Docs of has_key
should probably also mention that 'if key in dict' does the same, but I'm
not sure how to say that's new in Python 2.1.

-------------------------------------------------------

Date: 2001-Jan-23 22:57
By: twouters

Comment:
There yah go, Guido. Does my being awakened by my loud and malicious
partner (who needs to head to her office 4 hours before me) earn me yet
another free and legally useless 2.1 alpha ? :-)

Note: it's missing docs. Will add then once I figure out where to add them.
Also haven't updated the std-lib yet, will do that next.

-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=103395&group_id=5470