[Python-3000] Switch and static, redux
Guido van Rossum
guido at python.org
Fri Jul 7 22:17:49 CEST 2006
On 7/7/06, Georg Brandl <g.brandl at gmx.net> wrote:
> Ka-Ping Yee wrote:
> > On Wed, 5 Jul 2006, Guido van Rossum wrote:
> >> So, my proposal is to give up on static, accept PEP 3103 with the
> >> following options:
> >> - Syntax alternative 2+B (unindented cases, 'case in ...' for
> >> multiple cases).
> >> - Semantics option 3 (def-time freezing)
> >>
> >> Do we need any more discussion about the PEP before I pronounce? (I'm
> >> not super confident about the syntax alternatives yet.)
> >
> > I think i'd argue for indented cases, mainly because it's what
> > everyone expects. "Everyone" includes
> >
> > - people who have seen 'switch' in other languages
> > - people who expect ':' to introduce an indented block
> > - editors that autoindent new lines
> > - editors that fold indented blocks
> > - editor hotkeys/macros for manipulating indented blocks
> > - tools that highlight Python code
> > - interactive Python consoles
>
> I agree with Ping here. Indented cases are more consistent,
I think I've been convinced. I'll update the PEP.
> unless
> we come up with something to fill the "empty switch suite", such as
>
> switch expr:
> case 1:
> ...
>
> vs
>
> switch:
> expr
> case 1:
> ...
I don't think anything like this is likely to displace syntax
alternatives 1-4 in PEP 3103l, so I recommend that people not bother
to try.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list