Barry Warsaw wrote: > Okay, radical/insane/heretical question time: do we really need literal > tuple syntax? IOW, what if (1, 2, 3) created a frozenset instead of a > tuple? > > Or perhaps an even stupider idea: what if the compiler could recognize > certain use cases and generate different types depending on how the > object is used.
I think you'd have to create a tuple, and convert it to a set on the fly. Which should x be in the following: x = (1, 2, 1) dictOfCallables["foo"](x) My gut feeling is that you'd need to have PyPy's RPython to even begin taking a guess (and AFAIK, the above isn't valid RPython). > So, again, what if (...) created a set/frozen set instead of a tuple? > It's py3k, so broken code be damned. :) How would you have the following code be written? I'm curious what the syntax transformation would be. >>> a = (3,0) >>> b = (0,4) >>> c = (3,4) >>> def addpoint(a, b): ... return (a[0] + b[0], a[1] + b[1]) ... >>> tri[a] = "a" >>> tri[b] = "b" >>> tri[c] = "c" >>> assert tri[addpoint(a, b)] == "c" >>> > put-down-that-pitchfork-ly y'rs, > -Barry just-long-enough-to-light-my-torch-ly y'rs, ;) Eli _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
