used to look up a value
given its name, a dispatch table is used to look up a name given its
value. The switch statement then lets you actually do something based
on which name is returned.
-- Eric Sumner
___
Python-Dev mailing list
Python-Dev@pyt
le 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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.pyt
atch
> > table is defined. Each lookup is still O(1), so the whole operation
> > remains O(1).
>
> 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 la
heck that all of the cases in the switch are
defined in the dispatch table, but that only has to be done once per
dispatch table/switch statement pair, and can then be stred in one or
the other (probably the dispatch table, as that will be a proper
object).
-- Eric Sumner
___
are defined (such as in a module). Programmers don't
need to bother with making a dispatch table unless they are defining
enumeration values themselves.
-- Eric Sumner
Note: I sent an email yesterday with a proposal to this effect, but it
seems to have been lost. If anybody wants, I can r
dispatcher is executed (in order) and
their results are checked against the stored values. If no case (from
the switch, not the dispatcher) matches, the switch's 'else' block is
executed, if present. If more than one case (from the switch)
matches, an exception is raised. Otherwise, t
e about the internals of Python (such as how long a
check of a single variable takes relative to binding a new value to a
name), I can't properly evaluate how much of a problem this would be.
-- Eric Sumner
___
Python-Dev mailing list
Python-Dev@pytho
;m not
able to actually assess the feasability or performance implications of
this proposal, but I think it basically covers the problem.
-- Eric Sumner
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo
purpose and use.
Again, I concur. My point was not that the mechanics of the construct
were incorrect, but that the proposed syntax misrepresented its
function. Again, I am sorry if I was unclear about this.
-- Eric Sumner
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
suite
This is consistent with parameter lists, which emphasizes that the
sequences are being enumerated instead of simply tested against.
-- Eric Sumner
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python
at precomputation time.
How does this interact with __contains__, __len__, and __iter__ for
the 'case in S' statement? Would it work with a class that only
implements __contains__, such as a continuous range class?
-- Eric Sumner
___
Python
On 2/13/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Eric Sumner wrote:
> > I realize that I made an assumption that may not be valid;
> > namely, that a new scope is generated by the 'with' statement.
>
> The with statement uses the existing scope - its just
On 2/12/06, Josiah Carlson <[EMAIL PROTECTED]> wrote:
[paragraphs swapped]
> The desire for context managers to have access to its enclosing scope is
> another discussion entirely, though it may do so without express
> permission via stack frame manipulation.
My main point was that, with relativel
er of these
suggestions would be to implement, or if it would be a good idea to do
so. At this point, they are just something to think about
-- Eric Sumner
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/pytho
14 matches
Mail list logo