On Thu, Jan 16, 2014 at 01:08:47PM -0800, Ryan Smith-Roberts wrote:
socket.getservbyname(servicename[, protocolname])
This is not an inspectable signature, since pure Python does not support
bracketed arguments. To make it inspectable, we must give protocolname a
(valid Python) default
16.01.14 07:55, Larry Hastings написав(ла):
* itertools.repeat deliberately makes it impossible to provide an
argument for times that behaves the same as not providing the
times argument, and
* there is currently no way to implement this behavior using Argument
Clinic. (I'd have
16.01.14 08:05, Guido van Rossum написав(ла):
In this specific case it's clear to me that the special-casing of
negative count is intentional -- presumably it emulates sequence
repetition, where e.g. 'a'*-1 == ''.
In this specific case it's contrary to sequence repetition. Because
repeat('a',
On 1/16/2014 3:31 AM, Serhiy Storchaka wrote:
16.01.14 08:05, Guido van Rossum написав(ла):
In this specific case it's clear to me that the special-casing of
negative count is intentional -- presumably it emulates sequence
repetition, where e.g. 'a'*-1 == ''.
In this specific case it's
On Wed, 15 Jan 2014 21:55:46 -0800
Larry Hastings la...@hastings.org wrote:
Passing in None here is inconvenient as it's an integer argument.
Inconvenient for whom? The callee or the caller?
Regards
Antoine.
___
Python-Dev mailing list
On Thu, 16 Jan 2014 04:42:43 -0500
Terry Reedy tjre...@udel.edu wrote:
On 1/16/2014 3:31 AM, Serhiy Storchaka wrote:
16.01.14 08:05, Guido van Rossum написав(ла):
In this specific case it's clear to me that the special-casing of
negative count is intentional -- presumably it emulates
Am 16.01.2014 12:39, schrieb Antoine Pitrou:
On Thu, 16 Jan 2014 04:42:43 -0500
Terry Reedy tjre...@udel.edu wrote:
On 1/16/2014 3:31 AM, Serhiy Storchaka wrote:
16.01.14 08:05, Guido van Rossum написав(ла):
In this specific case it's clear to me that the special-casing of
negative
On 2014-01-16 05:32, Larry Hastings wrote:
[snip]
In the specific case of SHA1_new's string parameter, we could lie and
claim that the default value is b''. Internally we could still use NULL
as a default and get away with it. But this is only a happy
coincidence. Many (most?) functions like
On Thu, Jan 16, 2014 at 1:42 AM, Terry Reedy tjre...@udel.edu wrote:
On 1/16/2014 3:31 AM, Serhiy Storchaka wrote:
16.01.14 08:05, Guido van Rossum написав(ла):
In this specific case it's clear to me that the special-casing of
negative count is intentional -- presumably it emulates sequence
On Thu, Jan 16, 2014 at 12:31 AM, Serhiy Storchaka storch...@gmail.com wrote:
getattr(foo, 'bar', None) is not the same as getattr(foo, 'bar'). So None
can't be used as universal default value.
Not universal, but I still think that most functions don't need to
have such a subtle distinction.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 01/16/2014 12:32 AM, Larry Hastings wrote:
We could add a special value, let's call it sys.NULL, whose specific
semantics are turns into NULL when passed into builtins. This would
solve the problem but it's really, really awful.
That doesn't
On 01/16/2014 03:38 AM, Antoine Pitrou wrote:
On Wed, 15 Jan 2014 21:55:46 -0800
Larry Hastings la...@hastings.org wrote:
Passing in None here is inconvenient as it's an integer argument.
Inconvenient for whom? The callee or the caller?
The callee, specifically the C argument parsing code.
On 01/16/2014 04:21 AM, MRAB wrote:
On 2014-01-16 05:32, Larry Hastings wrote:
[snip]
We could add a special value, let's call it
sys.NULL, whose specific semantics are turns into NULL when passed into
builtins. This would solve the problem but it's really, really awful.
Would it be better
On 16/01/14 19:43, Larry Hastings wrote:
On 01/16/2014 04:21 AM, MRAB wrote:
On 2014-01-16 05:32, Larry Hastings wrote:
[snip]
We could add a special value, let's call it
sys.NULL, whose specific semantics are turns into NULL when passed into
builtins. This would solve the problem but it's
Let me expand on the issue, and address some of the replies.
The goal of Argument Clinic is to create new docstring signatures for
builtins, with the following properties:
1) Useful. While one can create a signature of func(*args) and then
document complex and arbitrary restrictions on what args
On Thu, Jan 16, 2014 at 1:42 AM, Terry Reedy tjre...@udel.edu wrote:
itertools.repeat('a', -1)
repeat('a', 0)
itertools.repeat('a', times=-1)
repeat('a')
itertools.repeat('a', times=-2)
repeat('a', -2)
The first line is correct in both behavior and representation.
The second line
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 01/16/2014 04:08 PM, Ryan Smith-Roberts wrote:
[L]et us return to my original example, getservbyname(). Its current
signature:
socket.getservbyname(servicename[, protocolname])
This is not an inspectable signature, since pure Python does
On 01/16/2014 01:08 PM, Ryan Smith-Roberts wrote:
There are two classes of builtins whose signatures do not have these
properties. The first is those with very weird signatures, like
curses.window.addstr(). It's fine that those don't get converted,
they're hopeless.
Speaking as the father
One of the downsides of converting positional-only functions to Argument
Clinic is that it can result in misleading docstring signatures. Example:
socket.getservbyname(servicename[, protocolname])
-
socket.getservbyname(servicename, protocolname=None)
The problem with the new signature is that
On Wed, Jan 15, 2014 at 7:57 PM, Ryan Smith-Roberts r...@lab.net wrote:
socket.getservbyname(servicename[, protocolname])
-
socket.getservbyname(servicename, protocolname=None)
Here is a more complicated example, since the above does technically have
an alternative fix:
On 01/15/2014 08:35 PM, Ryan Smith-Roberts wrote:
On Wed, Jan 15, 2014 at 7:57 PM, Ryan Smith-Roberts r...@lab.net
mailto:r...@lab.net wrote:
socket.getservbyname(servicename[, protocolname])
-
socket.getservbyname(servicename, protocolname=None)
Here is a more complicated
Well, I think these are mostly artifacts from old times, and usually
passing None *should* be the same as omitting the argument. But check each
case!
On Wednesday, January 15, 2014, Larry Hastings la...@hastings.org wrote:
On 01/15/2014 08:35 PM, Ryan Smith-Roberts wrote:
On Wed, Jan 15,
On 01/15/2014 09:37 PM, Guido van Rossum wrote:
Well, I think these are mostly artifacts from old times, and usually
passing None *should* be the same as omitting the argument. But check
each case!
Vajrasky Kok's recent posting to python-dev discusses the same problem.
His example is
On Wed, Jan 15, 2014 at 9:55 PM, Larry Hastings la...@hastings.org wrote:
On 01/15/2014 09:37 PM, Guido van Rossum wrote:
Well, I think these are mostly artifacts from old times, and usually passing
None *should* be the same as omitting the argument. But check each case!
Vajrasky Kok's
Am 16.01.2014 05:35, schrieb Ryan Smith-Roberts:
On Wed, Jan 15, 2014 at 7:57 PM, Ryan Smith-Roberts r...@lab.net
mailto:r...@lab.net wrote:
socket.getservbyname(servicename[, protocolname])
-
socket.getservbyname(servicename, protocolname=None)
Here is a more complicated
On 01/15/2014 10:21 PM, Georg Brandl wrote:
Am 16.01.2014 05:35, schrieb Ryan Smith-Roberts:
On Wed, Jan 15, 2014 at 7:57 PM, Ryan Smith-Roberts r...@lab.net
mailto:r...@lab.net wrote:
socket.getservbyname(servicename[, protocolname])
-
socket.getservbyname(servicename,
26 matches
Mail list logo