[Python-3000] Switch and static, redux

Georg Brandl g.brandl at gmx.net
Fri Jul 7 10:55:18 CEST 2006


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, unless
we come up with something to fill the "empty switch suite", such as

switch expr:
case 1:
    ...

vs

switch:
    expr
case 1:
    ...

Georg



More information about the Python-3000 mailing list