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

thanks,
Fabio
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to