Michael Hudson wrote: > > Tim Roberts <timr at probo.com> writes: > > > Joshua Marshall <jmarshal at mathworks.com> wrote: > > > > > >A switch statement may just be syntactic sugar, but not necessarily in > > >a simple way. A good compiler will compile switch statements into > > >jump-tables or, at worst, binary searches. Cluttery to code by hand. > > > > > >Sure this is "just" an efficiency thing, but switches can get quite big. > > > > But Python, at least today, is not compiled. > > Yes it is (at least in this context). > > > Switch statements in an interpreted language are not as big of a > > "win". > > There's no reason that the bytecode compiler couldn't do binary search > jiggery-pokery, although if I was doing it, I'd probably use a > dictionary. > > Cheers, > M. > > -- > MGM will not get your whites whiter or your colors brighter. > It will, however, sit there and look spiffy while sucking down > a major honking wad of RAM. -- http://www.xiph.org/mgm/ Actually, switch "implementation" above that uses dictionary's which is hashed. So a supported switch statement should be able to do hash as well.
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