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
Re: [wxpython-users] To wxPython developers
by Chester other posts by this author
May 7 2008 11:16AM messages near this date
Re: [wxpython-users] py2app Mac | Re: Re: [wxpython-users] To wxPython developers
I just want to make wxPython source code perfect. It is better to do
if 'wxPython.wx' in sys.modules:    rather than   if
sys.modules.has_key('wxPython.wx'):

Though the latter gives the exact same functionality as the former, it
is still better to do the former. The reason is that the method
has_key() has been deprecated in Python 3.0, and I can see why. You
might still ask why? Well, because it is ugly. :)  Guido van Rossum
agrees. The  in  statement is a very powerful statement. Use it! :)



On Wed, May 7, 2008 at 6:02 PM, Werner F. Bruhin <werner.bruhin@[...].fr>  wrote:
>  Chester,
> 
>   Chester wrote:
> 
>  > Dear developers of wxPython, please visit this link:
>  > http://svn.wxwidgets.org/svn/wx/wxPython/trunk/wxPython/media.py.
>  > Since I don't have access to make the fix, I ask you to change the
>  > line
>  >
>  > if sys.modules.has_key('wxPython.wx'):
>  > to
>  > if 'wxPython.wx' in sys.modules:
>  >
>  >
>  > My proposal looks more clean and also Python 3.0 doesn't have the
>  > has_key() method anymore, so this will aid future headaches. ;)
>  >
>  >
>   I am not one of the wxPython experts, but I believe that all this is to
>  support the old style of imports.  I doubt that many people are still using
>  this (although there is still a bit of stuff hanging around on the wiki) and
>  if they do they should anyhow switch over to the new namespace stuff.
> 
>   Good things for you to read:
>   http://wxpython.org/migrationguide.php
>   http://wiki.wxpython.org/wxPython%20Style%20Guide
>   http://wiki.wxpython.org/How%20to%20Learn%20wxPython
> 
>   Werner
>   _______________________________________________
>   wxpython-users mailing list
>   wxpython-users@[...].org
>   http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
> 
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
Chester
Werner F. Bruhin
Mariano Di Felice
Robin Dunn
Robin Dunn
Christopher Barker
Mariano Di Felice
Christopher Barker
Mariano Di Felice
Christopher Barker
Mariano Di Felice
Christopher Barker
Mariano Di Felice
Robin Dunn
Mariano Di Felice
Robin Dunn
Mariano Di Felice
Chester
Tim Roberts
Chester
Werner F. Bruhin
Chester

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved