On Wed, Apr 04, 2012 at 11:03:02AM -0700, Ethan Furman wrote:
> Oleg Broytman wrote:
> > . Pythonic equivalent of "get_clock(THIS) or get_clok(THAT)" is
> >
> >for flag in (THIS, THAT):
> > try:
> > clock = get_clock(flag)
> > except:
> > pass
> > else:
> > break
> >else:
> > raise ValueError('Cannot get clock, tried THIS and THAT')
>
>
> Wow -- you'd rather write nine lines of code instead of three?
>
> clock = get_clock(THIS) or get_clock(THAT)
> if clock is None:
> raise ValueError('Cannot get clock, tried THIS and THAT')
Yes - to force people to write the last two lines. Without forcing
most programmers will skip them.
Oleg.
--
Oleg Broytman http://phdru.name/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com