ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
[wxpython-users] has_key() method versus the 'in' statement
by Chester other posts by this author
May 7 2008 1:05PM messages near this date
Re: [wxpython-users] Dialog v. Frame | Re: [wxpython-users] has_key() method versus the 'in' statement
my_dictionary = {"banana": 123, "orange": 456}


if my_dictionary.has_key("orange"):                      UGLY
...

if my_dictionary.has_key("orange") == False:      UGLY
...

if not my_dictionary.has_key("orange"):                UGLY
...

_____________________________________________________


if "orange" in my_dictionary:                                 CLEAN
...

if "orange" not in my_dictionary:                           CLEAN
...
Thread:
Chester
Tim van der Leeuw
Phillip Watts
Kevin Ollivier
Chester
Phillip Watts
Tim Roberts
Chester

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved