Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 18:07, Ethan Furman <et...@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. Please don't force Python users to write pseudo-C code
in Python.

You mean like the dict.get() function?

--> repr({}.get('missing'))
'None'

Plus, failure mode is based on intent: if the intent is "Give a clock no matter what", then yes, an exception when that's not possible is the way to go.

But if the intent is "Give me a clock that matches this criteria" then returning None is perfectly reasonable.

~Ethan~
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to