Fabio Z Tessitore wrote:
> Hi all,
> 
> reading Dive Into Python, on Chapter 6 (exception), I've found:
> 
> "This code comes from the getpass module, a wrapper module for getting a 
> password from the user"
> 
> try:
>       import termios, TERMIOS
> except ImportError:
>       try:
>               import msvcrt
>       except ImportError:
>               try:
>                       from EasyDialogs import AskPassword
>               except ImportError:
>                       getpass = default_getpass
>               else:
>                       getpass = AskPassword
>       else:
>               getpass = win_getpass
> else:
>       getpass = unix_getpass
> 
> Knowing that this code is very simple, my question is about simplicity. I 
> think it is simpler the following code. I haven't a long experience on 
> Python, so I'd like to know your opinions about.
> 
> try:
>       import termios, TERMIOS
>       getpass = unix_getpass
> 
> except ImportError:
>       try:
>               import msvcrt
>               getpass = win_getpass
> 
>       except ImportError:
>               try:
>                       from EasyDialogs import AskPassword
>                       getpass = AskPassword
> 
>               except ImportError:
>                       getpass = default_getpass
> 
In matters of style such as this there *are* only opinions. I don't 
think there are definite grounds for preferring either one.

If you were to propose such a patch on the python-dev list, it would 
almost certainly be rejected - not because it is necessarily worse, but 
because it would represent a change of style only.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to