cleaner way to write this?
Ben Finney
bignose+hates-spam at benfinney.id.au
Wed Oct 25 19:42:39 EDT 2006
John Salerno <johnjsal at NOSPAMgmail.com> writes:
> if dlg.ShowModal() == wx.ID_OK:
> db_name = dlg.GetValue()
> dlg.Destroy()
> return db_name
> else:
> dlg.Destroy()
> return
It's for reasons like this that I prefer to have only one 'return'
from my functions.
db_name = None
if dlg.ShowModal() == wx.ID_OK:
db_name = dlg.GetValue()
dlg.Destroy()
return db_name
--
\ "I was trying to daydream, but my mind kept wandering." -- |
`\ Steven Wright |
_o__) |
Ben Finney
More information about the Python-list
mailing list