cleaner way to write this?

John Salerno johnjsal at NOSPAMgmail.com
Wed Oct 25 14:42:03 EDT 2006


Paul Rubin wrote:
> John Salerno <johnjsal at NOSPAMgmail.com> writes:
>> I just need some advice for how to structure
>> the check of the empty string.
> 
> How about
> 
>     return db_name or None
> 
> since the empty string taken as a boolean is False.

But if the user doesn't enter any text, I don't want the method to 
return at all (even None). I need an error dialog to pop up and tell him 
to enter a value (or press Cancel).



More information about the Python-list mailing list