[Python-ideas] PEP-3151 pattern-matching

Antoine Pitrou solipsis at pitrou.net
Fri Apr 8 21:06:50 CEST 2011


On Fri, 8 Apr 2011 15:00:50 -0400
Devin Jeanpierre <jeanpierreda at gmail.com>
wrote:
> What this PEP does is introduce a language-specific exception
> hierarchy instead. I think it's a good idea, but it's not as clearly
> superior to errnos as you suggest. It's easier to remember the
> language-specific exception hierarchy if you don't have to deal with
> other languages that use errnos, but if you do, the situation is
> different.

True, but that's like saying we should use sprintf() for string
formatting and fgets() for file access since other languages such as C
and PHP use them. In trying to find elegant solutions to problems, we
often diverge from solutions common in other languages.

(actually, if we followed the errno paradigm closely, we shouldn't even
raise exceptions, but return the error code or store it in a
thread-local variable instead ;-))

Regards

Antoine.





More information about the Python-ideas mailing list