A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-April/053102.html below:

[Python-Dev] Re: switch statement

[Python-Dev] Re: switch statement [Python-Dev] Re: switch statementMichael Walter michael.walter at gmail.com
Thu Apr 28 14:46:22 CEST 2005
On 4/28/05, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> >>>>> "Guido" == Guido van Rossum <gvanrossum at gmail.com> writes:
> 
>     Guido> You mean like this?
> 
>     if x > 0:
>         ...normal case...
>     elif y > 0:
>         ....abnormal case...
>     else:
>         ...edge case...
> 
> The salient example!  If it's no accident that those conditions are
> mutually exclusive and exhaustive, doesn't that code require at least
> a comment saying so, and maybe even an assertion to that effect?

I usually do:

if ...:
  return ...
if ...:
  return ...
assert ...
return ...

Michael
More information about the Python-Dev mailing list

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