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/2001-November/018597.html below:

"Switching on Multiple Values", Rev 1.1

[Python-Dev] PEP 275: "Switching on Multiple Values", Rev 1.1M.-A. Lemburg mal@lemburg.com
Tue, 13 Nov 2001 19:44:43 +0100
Jack Jansen wrote:
> 
> Even though I'm not sure I like the switch idea (and I won't even contemplate
> how Guido will react when he comes back and sees what we've been spending our
> time on:-) there's one very special case of switch that I would like, and
> that's the Algol 68 style switch on type. If we had something like
>   def foo(x):
>      switch type(x):
>         case int:
>           do something
>         case string:
>           do something else
> this would be a nice point to hook into for something that tries to compile
> Python to C or somesuch.
> 
> Hmm, you would probably need a tuple-based switch as well:
>    switch type(x), type(y):
>      case int, int:
>         ....

All this should be possible with the proposed extensions since
type objects are immutable and hashable.

I'll add your example to the PEP.

Thanks,
-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/



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