Oleg Broytman wrote: > On Wed, Apr 04, 2012 at 05:47:16PM +0200, Lennart Regebro wrote: >> On Tue, Apr 3, 2012 at 18:07, Ethan Furman <ethan at stoneleaf.us> wrote: >>> What's unclear about returning None if no clocks match? >> Nothing, but having to check error values on return functions are not >> what you typically do in Python. Usually, Python functions that fail >> raise an error. > > Absolutely. "Errors should never pass silently." Again, what's the /intent/? No matching clocks does not have to be an error. >> Please don't force Python users to write pseudo-C code in Python. > > +1. 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') ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4