cleaner way to write this?

John Salerno johnjsal at NOSPAMgmail.com
Wed Oct 25 20:26:27 CEST 2006


Paul Rubin wrote:

> I like
> 
>     if dlg.ShowModal() == wx.ID_OK:
>          db_name = dlg.GetValue()
>     else:
>          db_name = None
>     dlg.Destroy()
>     return db_name
> 
> better than
> 
>     db_name = None
>     if dlg.ShowModal() == wx.ID_OK:
>          db_name = dlg.GetValue()
>     dlg.Destroy()
>     return db_name
>

Thanks guys! I didn't think about setting db_name to None in that way!



More information about the Python-list mailing list