At 06:56 PM 6/18/2006 -0700, Josiah Carlson wrote: >The non-fast version couldn't actually work if it referenced any names, >given current Python semantics for arbitrary name binding replacements.
Actually, one could consider "case" expressions to be computed at function definition time, the way function defaults are. That would solve the problem of symbolic constants, or indeed any sort of expressions. An alternate possibility would be to have them computed at first use and cached thereafter. Either way would work, and both would allow multiple versions of the same switch statement to be spun off as closures without losing their "constant" nature or expressiveness. It's just a question of which one is easier to explain. Python already has both types of one-time initialization: function defaults are computed at definition time, and modules are only loaded once, the first time you import them. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com