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

[Python-Dev] PEP 3103: A Switch/Case Statement

[Python-Dev] PEP 3103: A Switch/Case Statement [Python-Dev] PEP 3103: A Switch/Case StatementFredrik Lundh fredrik at pythonware.com
Thu Jun 29 16:38:20 CEST 2006
Eric Sumner wrote:

>> You mean something like this?:
>>
>>    switch x in colours:
>>      case RED:
>>          # whatever
>>      case GREEN:
>>          # whatever
>>      case BLUE:
>>          # whatever
>>
>> I think Guido's right. It doesn't solve the underlying problem because the
>> compiler still has to figure out how to build a dispatch table from the
>> possible values in colours to the actual bytecode offsets of the cases.
>
> To implement this, you actually need two lookup tables: one particular
> to the switch that maps labels to bytecode offsets, and one in the
> dispatch table to map values to labels.  The former is built when the
> switch is compiled, and the latter is built wherever the dispatch
> table is defined.  Each lookup is still O(1), so the whole operation
> remains O(1).

what's a "label" ?

</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