<div class="gmail_quote"><div>I'm just going to throw myself in the conversation obtusely.I felt we needed some real code. These are literally the first two samples I had on hand.</div><div><br></div><div>!!! OUT OF CONTEXT REAL CODE ALERT !!! </div>
<div><br></div></div><div>###################################</div><br><div><div><font face="'courier new', monospace">formatter = formatter.format(**color).replace("(","{").replace(")","}")</font></div>
<div><font face="'courier new', monospace">print("\n\n".join(formatter.format(**d) for d in db))</font></div></div><div><font face="'courier new', monospace"><br></font></div><div><span style="font-family:'courier new',monospace"># vs #</span></div>
<div><span style="font-family:'courier new',monospace"><br></span></div><div><div><div><font face="'courier new', monospace">formatter = formatter.format(::(), ::color).replace("(","{").replace(")","}")</font></div>
<div><font face="'courier new', monospace">print("\n\n".join(formatter.format(::(), ::d) for d in db))</font></div></div></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"># What do we do for "format(**kwargs)"?</font></div>
<div><font face="'courier new', monospace"># With the current guess of mine, I'm thinking "what does ::() do?" and "why are there two double-colons?".</font></div><div><font face="'courier new', monospace"># Aside from that it looks not much different/worse.</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"># and #</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><div style="font-family:'courier new',monospace">def checkLoad(self, *args, **kwargs):</div><div style="font-family:'courier new',monospace">
<span style="white-space:pre-wrap"> </span>if getattr(self, x) == None: getattr(self, loadx)()</div><div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>if fakeself:</div>
<div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>return function(getattr(self, x), *args, **kwargs)</div><div style="font-family:'courier new',monospace">
<span style="white-space:pre-wrap"> </span>else:</div><div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>return function(self, *args, **kwargs)</div>
<div style="font-family:'courier new',monospace">return checkLoad</div><div style="font-family:'courier new',monospace"><br></div><div style="font-family:'courier new',monospace"># vs #</div><div style="font-family:'courier new',monospace">
<br></div><div><div style="font-family:'courier new',monospace">def checkLoad(self, tuple::args, dict::kwargs):</div><div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>if getattr(self, x) == None: getattr(self, loadx)()</div>
<div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>if fakeself:</div><div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>return function(getattr(self, x), ::args, ::kwargs)</div>
<div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>else:</div>
<div style="font-family:'courier new',monospace"><span style="white-space:pre-wrap"> </span>return function(self, ::args, ::kwargs)</div><div style="font-family:'courier new',monospace">return checkLoad</div>
<div style="font-family:'courier new',monospace"><br></div><div><font face="'courier new', monospace"># It looks much the same, but how does it benefit me?</font></div><div style="font-family:'courier new',monospace">
# "*args" is very distinct from "**kwargs" in my opinion. "tuple"/"dict" doesn't have that.</div><div style="font-family:'courier new',monospace"># That said, the second works better with my syntax highlighter (although pylint then swears at me).</div>
<div style="font-family:'courier new',monospace"><br></div></div><div style="font-family:'courier new',monospace">#############################################################</div>
<div style="font-family:'courier new',monospace"><br></div><div><font face="arial, helvetica, sans-serif">Before I actually put the syntax in context I hated this. Now I just really dislike it.</font></div><div><font face="arial, helvetica, sans-serif"><br>
</font></div><div><font face="arial, helvetica, sans-serif">There is one big thing bugging me: </font><font face="arial, helvetica, sans-serif">How do I do: "foo</font><span style="font-family:arial,helvetica,sans-serif">(**kwargs)"? My solution was to use "foo(::(), ::kwargs)", but it's obviously not a great alternative.</span></div>
</div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">There is another, smaller one. Wrapper functions often just want to pass values straight through them. They don't care that it's a tuple. They don't care that it's a dict. They're just going to throw it across. Without "def foo(::args)" syntax, that's just a waste of a lookup. With "def foo(::args)" syntax you lose the discrimination of args and kwargs, resulting in the same problem above. Finally, it's uglier when without.</span></div>
<div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">I do have one suggestion:</span></div><div><span style="font-family:'courier new',monospace">foo(*args, **kwargs): pass</span></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">foo(tuple(*) args, dict(**) kwargs): pass</font></div><div><font face="'courier new', monospace"><br>
</font></div><div><font face="'courier new', monospace">foo(dict(**) kwargs): pass</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">foo(*, bar="spam"): pass</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"># this is illegal because unbound "catchalls" don't catch anything, as they do today</font></div>
<div><font face="'courier new', monospace">foo(tuple(*), bar="spam"): pass</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="arial, helvetica, sans-serif" size="1">I'll leave you to guess how it works. If you can't it's obviously not obvious enough.</font></div>
<div><font face="arial, helvetica, sans-serif" size="1"><br></font></div><div><font face="arial, helvetica, sans-serif" size="1">Advantages:</font></div><div><font face="arial, helvetica, sans-serif" size="1">"*" means a catchall, as it should.</font></div>
<div><font face="arial, helvetica, sans-serif" size="1">"*" is distinct from "**".</font></div><div><font face="arial, helvetica, sans-serif" size="1">With syntax highlighting, it's pretty obvious what is going on.</font></div>
<div><font face="arial, helvetica, sans-serif" size="1">It's backwards compatible (the main reason it's not "tuple(*):args").</font></div><div><font face="arial, helvetica, sans-serif" size="1"><br></font></div>
<div><font face="arial, helvetica, sans-serif" size="1"><b>My main problem is: use case? I've had none at all.</b></font></div><div><font face="arial, helvetica, sans-serif" size="1">If only 1% of users want it, it's not right to make the 99% change. Saving <i>one line and 50 microseconds</i> per hundred uses of (*/**) is not a valid argument.And don't make us all change all our code just to satisfy that. The only argument you can make is readability, but (*/**) is more explicit than a lookup, just because it's not dependant on position (args/kwargs argument) and it's always a real tuple and dict.</font></div>
<div><font face="arial, helvetica, sans-serif" size="1"><br></font></div><div><font face="arial, helvetica, sans-serif" size="1">def tuple(): </font><span style="font-family:arial,helvetica,sans-serif;font-size:x-small">1/0</span></div>