[Yes, this should probably go to python-list, but after surgery I haven't been on c.l.py for more than a month.] M.-A. Lemburg wrote: > > Here is a new revision of the switch PEP. After this round and > after Guido returns to python-dev, I intend to do one or two > more rounds on python-list. Here's a weird idea: Given that the main problem we're trying to solve is the slowness of dictionary dispatching to functions, how about adding an "inline" keyword or function? For example (assuming it's a function): def handle_data(): self.append(data) dispatch_dict["foo"] = handle_data class C: def read_input(self): data = "foo" value = handle_data inline(dispatch_dict[value]) Note carefully that handle_data() has no paramaters. This solution would be somewhat more expensive computationally than the switch construct, but it ought to be cheaper than doing an actual function call. -- --- Aahz (@pobox.com) Hugs and backrubs -- I break Rule 6 <*> http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista We must not let the evil of a few trample the freedoms of the many.
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