Re: [Python-Dev] School IIb?

2006-06-28 Thread Guido van Rossum
On 6/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > I just wish I could figure out what school my original micro-PEP belongs > to (but as long as my implementation note is still just a draft, I guess no- > body else can figure that out either... ;-) There aren't just schools; there are alternat

Re: [Python-Dev] School IIb?

2006-06-28 Thread Fredrik Lundh
Guido van Rossum wrote: >> that's not true for all programming languages that has a switch construct, >> though; >> the common trait is that you're dispatching on a single value, not >> necessarily that >> there cannot be potentially overlapping case conditions. > > You have a point. that can h

Re: [Python-Dev] School IIb?

2006-06-28 Thread Guido van Rossum
On 6/28/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Phillip J. Eby wrote: > > > Hear, hear! We already have if/elif, we don't need another way to spell > > it. The whole point of switch is that it asserts that exactly *one* case > > is supposed to match > > that's not true for all programming

Re: [Python-Dev] School IIb?

2006-06-28 Thread Fredrik Lundh
Phillip J. Eby wrote: > Hear, hear! We already have if/elif, we don't need another way to spell > it. The whole point of switch is that it asserts that exactly *one* case > is supposed to match that's not true for all programming languages that has a switch construct, though; the common trait

[Python-Dev] School IIb?

2006-06-27 Thread Jim Jewett
> On compilation, freeze any cases that meet the School-II conditions > and have a trustworthy __hash__ method into a dictionary. As long as the semantics are based on if-elif, you have to support if(optimizable) elif (has a side effect) elif (optimizable) elif (not optimizabl

Re: [Python-Dev] School IIb?

2006-06-26 Thread Phillip J. Eby
At 03:52 PM 6/26/2006 -0700, Guido van Rossum wrote: >It's the >messiness of trying to define rules that are as flexible as needed for >optimization and yet claiming to maintain the strict if/elif-chain >semantics. Hear, hear! We already have if/elif, we don't need another way to spell it. The

Re: [Python-Dev] School IIb?

2006-06-26 Thread Guido van Rossum
On 6/26/06, Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > Here's a possible adjustment to the School-II approach that i think > avoids the issues i've been raising, while giving the desired > O(n)-to-O(1) speedup in common situations. It's basically School-II > dispatch, plus a check: > > On compilatio

[Python-Dev] School IIb?

2006-06-26 Thread Ka-Ping Yee
Here's a possible adjustment to the School-II approach that i think avoids the issues i've been raising, while giving the desired O(n)-to-O(1) speedup in common situations. It's basically School-II dispatch, plus a check: On compilation, freeze any cases that meet the School-II conditions and hav