[Python-Dev] Argument Clinic: what to do with builtins with non-standard signatures?

Nick Coghlan ncoghlan at gmail.com
Sat Jan 25 10:20:22 CET 2014


On 25 January 2014 17:44, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 25 January 2014 01:07, Larry Hastings <larry at hastings.org> wrote:
>> c) Functions that accept an 'int' when they mean 'boolean' (aka the
>>    "ints instead of bools" problem)
>>
>>    Solution:
>>      1) Use "bool".
>>      2) Use "int", and I'll go relax Argument Clinic so they
>>         can use bool values as defaults for int parameters.
>
> If the temptation is to use True or False as the default, then I think
> that's a clear argument that these should be accepting "bool".
> However, expanding the accepted types is also clearly a new feature
> that would need a "versionchanged" in the docs for all affected
> functions, so I think these changes also belong in the "conversion
> implies semantic changes, so leave until 3.5" category.

I changed my mind (slightly) on this one. For 3.4, we can go with
converting the current semantics (i.e. using "i"), and tweaking
argument clinic to all bool defaults for integers.

That allows the introspection to be added sensibly, without changing
the semantics of the interface.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list