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/2006-June/066663.html below:

[Python-Dev] Switch statement - handling errors

[Python-Dev] Switch statement - handling errorsKa-Ping Yee python-dev at zesty.ca
Wed Jun 28 05:21:20 CEST 2006
On Tue, 27 Jun 2006, Jim Jewett wrote:
> (Almost) everyone agrees that the case expressions SHOULD be run-time
> constants.  The disagreements are largely over what to do when this
> gets violated.

I like your summary and understood most of it (options 1, 2, 3, 5, 6).
The only part i didn't understand was this:

> Bad Case Option (4) -- Ignore problems
> --------------------------------------
>
> This is for optimization; go ahead and ignore any problems you can.
> Maybe that branch will never be taken...  Ironically, this is also
> largely school I, since it matches the if semantics.

Could you elaborate on what this means?  Does "ignore any problems"
mean "even if a case value changes, pretend it didn't change"?  But
that wouldn't match the 'if' semantics, so i'm not sure what you
had in mind.

> Bad Case Option (6) -- Undefined
> --------------------------------
[...]
> The down side is that people may start to count on the actual behavior
> anyhow; then (in practice) we might just have Bad Case Option (5)
> without documentation.

I agree with this last paragraph.  Option 6 seems the most risky of all.


-- ?!ng
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