<div dir="ltr"><div style class="markdown-here-wrapper"><p style="margin:1.2em 0px!important">OK, i think it’s time to finally switch to python 3 instead of writing more horrible crutches:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248) none repeat scroll 0% 0%" class="hljs language-python"><span style="color:rgb(153,153,136);font-style:italic" class="hljs-comment"># coding: utf-8</span>
<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> __future__ <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> absolute_import, division, print_function, unicode_literals
<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> builtins <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> *

<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> trollius
<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> trollius <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> From, Return

<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> other <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> stuff

<span class="hljs-decorator">@trollius.coroutine</span>
<span class="hljs-decorator">@modifiers.kwoargs('b')</span>
<span class="hljs-function"><span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">def</span> <span style="color:rgb(153,0,0);font-weight:bold" class="hljs-title">awesome_stuff</span><span class="hljs-params">(a, b=<span style="color:rgb(0,128,128)" class="hljs-number">5</span>)</span>:</span>
    res = (<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">yield</span> From(stuff()))
    <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">raise</span> Return(res)
</code></pre>
<p style="margin:1.2em 0px!important">vs.</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248) none repeat scroll 0% 0%" class="hljs language-python"><span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> asyncio

<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> other <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> stuff

<span class="hljs-decorator">@asyncio.coroutine</span>
<span class="hljs-function"><span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">def</span> <span style="color:rgb(153,0,0);font-weight:bold" class="hljs-title">awesome_stuff</span><span class="hljs-params">(a, *, b=<span style="color:rgb(0,128,128)" class="hljs-number">5</span>)</span>:</span>
    res = (<span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">yield</span> <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> stuff())
    <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">return</span> res
</code></pre>
<p style="margin:1.2em 0px!important">or soon:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248) none repeat scroll 0% 0%" class="hljs language-python"><span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">from</span> other <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">import</span> stuff

async <span class="hljs-function"><span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">def</span> <span style="color:rgb(153,0,0);font-weight:bold" class="hljs-title">awesome_stuff</span><span class="hljs-params">(a, *, b=<span style="color:rgb(0,128,128)" class="hljs-number">5</span>)</span>:</span>
    res = await stuff()
    <span style="color:rgb(51,51,51);font-weight:bold" class="hljs-keyword">return</span> res
</code></pre>
<p style="margin:1.2em 0px!important">Yann Kaiser <a href="http://mailto:kaiser.yann@gmail.com">kaiser.yann@gmail.com</a> schrieb am Sa., 20. Juni 2015 um 19:52 Uhr:</p>
<p style="margin:1.2em 0px!important"></p><div class="markdown-here-exclude"><p></p><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, 17 Jun 2015 at 21:33 Nathaniel Smith <<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">there's really no good way to accomplish kw only args in py2. It can be done, but it's very cumbersome; not like range or print or whatever where you can just import something from six or add some parentheses.</p></blockquote></div></div><div dir="ltr"><div class="gmail_quote"><div>As you correctly point out, it can't be done without friction.</div><div><br></div><div>I've attempted backporting kw-only parameters through decorators:</div><div><br></div><div>from sigtools import modifiers</div><div><br></div><div>@modifiers.kwoargs('kwop')</div><div>def func(abc, kwop):</div><div>    ...</div><div><br></div><div>@modifiers.autokwoargs</div><div>def func(abc, kwop=False):</div><div>    ...</div><div><br></div><div><a href="http://sigtools.readthedocs.org/en/latest/#sigtools.modifiers.kwoargs" target="_blank">http://sigtools.readthedocs.org/en/latest/#sigtools.modifiers.kwoargs</a> </div></div></div>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a></blockquote><p></p></div><p style="margin:1.2em 0px!important"></p>
<div title="MDH:PGRpdj48ZGl2PjxkaXY+T0ssIGkgdGhpbmsgaXTigJlzIHRpbWUgdG8gZmluYWxseSBzd2l0Y2gg
dG8gcHl0aG9uIDMgaW5zdGVhZCBvZiB3cml0aW5nIG1vcmUgaG9ycmlibGUgY3J1dGNoZXM6PGJy
PjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+YGBgcHl0aG9uPGJyPjwvZGl2PjxkaXY+IyBjb2Rp
bmc6IHV0Zi04PGJyPjwvZGl2PjxkaXY+ZnJvbSBfX2Z1dHVyZV9fIGltcG9ydCBhYnNvbHV0ZV9p
bXBvcnQsIGRpdmlzaW9uLCBwcmludF9mdW5jdGlvbiwgdW5pY29kZV9saXRlcmFsczxicj5mcm9t
IGJ1aWx0aW5zIGltcG9ydCAqPGJyPjwvZGl2PjxkaXY+PGJyPmltcG9ydCB0cm9sbGl1czxicj5m
cm9tIHRyb2xsaXVzIGltcG9ydCBGcm9tLCBSZXR1cm48YnI+PGJyPjwvZGl2PjxkaXY+ZnJvbSBv
dGhlciBpbXBvcnQgc3R1ZmY8YnI+PC9kaXY+PGRpdj48YnI+QHRyb2xsaXVzLmNvcm91dGluZTxi
cj5AbW9kaWZpZXJzLmt3b2FyZ3MoJ2InKTxicj48L2Rpdj48ZGl2PmRlZiB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21haWxtYTx3YnI+
bi9saXN0aW5mby9weXRob24taWRlYXM8L2E+PGJyPgpDb2RlIG9mIENvbmR1Y3Q6IDxhIGhyZWY9
Imh0dHA6Ly9weXRob24ub3JnL3BzZi9jb2Rlb2Zjb25kdWN0LyIgcmVsPSJub3JlZmVycmVyIiB0
YXJnZXQ9Il9ibGFuayI+aHR0cDovL3B5dGhvbi5vcmcvcHNmL2NvZGVvZmNvPHdicj5uZHVjdC88
L2E+PC9ibG9ja3F1b3RlPjwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div>