<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 01/21/2014 12:59 AM, Serhiy
Storchaka wrote:<br>
</div>
<blockquote cite="mid:lblcsd$tm6$1@ger.gmane.org" type="cite">21.01.14
04:44, Nikolaus Rath написав(ла):
<br>
<blockquote type="cite">Serhiy Storchaka
<a class="moz-txt-link-rfc2396E" href="mailto:storchaka@gmail.com"><storchaka@gmail.com></a> writes:
<br>
<blockquote type="cite">20.01.14 06:19, Nikolaus Rath
написав(ла):
<br>
<blockquote type="cite">This works if the user calls
time.gmtime(None), but it fails for
<br>
time.gmtime(). It seems that in that case my C converter
function is
<br>
never called.
<br>
<br>
What's the trick that I'm missing?
<br>
</blockquote>
<br>
/*[clinic input]
<br>
time.gmtime
<br>
<br>
[
<br>
seconds: time_t
<br>
]
<br>
/
<br>
<br>
</blockquote>
<br>
Ahh, interesting. So this works, but now the C default is
evaluated even
<br>
if the user passed an argument (so that answers my question
about
<br>
decreased performance in the other subthread). The generated
code is:
<br>
</blockquote>
<br>
Don't use time(NULL) as C default. Instead check group_right_1 and
call time(NULL) explicitly.<br>
</blockquote>
<br>
While this "trick" works, it abuses optional groups. Optional
groups are intended as a last resort, for semantics that can't be
expressed any other way. The semantics of time.gmtime() are very
easily expressed using normal Python syntax. Please don't use
optional groups here.<br>
<br>
<br>
<i>/arry</i><br>
</body>
</html>