Pythonification of the asterisk-based collection packing/unpacking syntax

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Dec 22 08:12:57 EST 2011


On Thu, 22 Dec 2011 06:49:16 -0500, Neal Becker wrote:

> I agree with the OP that the current syntax is confusing.  The issue is,
> the meaning of * is context-dependent.

Here you are complaining about an operator being "confusing" because it 
is context-dependent, in a post where you strip all context except the 
subject line and expect us to still understand what you're talking about. 
There's a lesson there, I'm sure.


* is context dependent. You know what else is context dependent? Well, 
most things. But in particular, parentheses. Clearly they must be 
"confusing" too. So how about we say:

class MyClass superclasslist A, B C:
    def method argumentlist self, x, y:
        t = tuple 1, 2 tuple 3, 4 endtuple endtuple
        return group x + y endgroup * group x - y endgroup


Much less confusing!



-- 
Steven



More information about the Python-list mailing list