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

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

[Python-Dev] PEP 3103: A Switch/Case StatementEric Sumner kd5bjo at gmail.com
Thu Jun 29 17:18:12 CEST 2006
> >> what's a "label" ?
> >
> > In your example, RED, GREEN, and BLUE.  colours provides a mapping
> > from values to labels/cases, and the switch statement provides a
> > mapping from labels/cases to code.  Sorry about introducing a new term
> > without saying anything about it.
>
> yeah, but what are they?  integers?  strings?  names without an associated value?
Syntactically, they are bare words (names).  They are constants, and
compare equal to other identical labels.

> how do you create new labels?
To the programmer, all valid labels exist; you just use them.  They
are only used in very particular places in the grammar.  Internally,
they are probably represented by strings.

> where are they stored?
They are stored by the internal representation of any construct that
uses them.  That would be dispatch table objects and compiled switch
statements.

> who keeps track of them?
Each construct keeps track of its own copies, and destroys them when
they are no longer needed.

  -- Eric Sumner
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