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/065866.html below:

[Python-Dev] Switch statement

[Python-Dev] Switch statement [Python-Dev] Switch statementFredrik Lundh fredrik at pythonware.com
Mon Jun 12 00:44:50 CEST 2006
Talin wrote:

> I don't have any specific syntax proposals, but I notice that the suite 
> that follows the switch statement is not a normal suite, but a 
> restricted one, and I am wondering if we could come up with a syntax 
> that avoids having a special suite.

don't have K&R handy, but I'm pretty sure they put switch and case at 
the same level (just like if/else), thus eliminating the need for silly 
special suites.

> The only real difference between this and an if-else chain is that the 
> compiler knows that all of the test expressions are constants and can be 
> hashed at compile time.

the compiler can of course figure that out also for if/elif/else state- 
ments, by inspecting the AST.  the only advantage for switch/case is 
user syntax...

</F>

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