The slash "/" as used in the documentation
Terry Reedy
tjreedy at udel.edu
Mon Feb 11 02:16:44 EST 2019
On 2/10/2019 10:47 AM, Ian Kelly wrote:
> On Sat, Feb 9, 2019 at 1:19 PM Terry Reedy <tjreedy at udel.edu> wrote:
>>
>> This is the result of Python being a project of mostly unpaid volunteers.
>>
>> See my response in this thread explaining how '/' appears in help output
>> and IDLE calltips. '/' only appears for CPython C-coded functions that
>> have been modified to use Argument Clinic. A.C. was added, I believe,
>> in 3.5. Simple builtins like len would have been the first to be
>> converted. The math module was converted for 3.7. There are some new
>> conversions for 3.8 and likely some will be left for future versions.
>
> I'm sure there are good reasons for it like most things Python does, but I
> can't help but wonder if working on removing the positional limitation from
> CPython would be a better use of time.
The pass-by-position limitation is not in CPython, it is the behavior of
C functions, which is the behavior of function calls in probably every
assembly and machine language. Allowing the flexibility of Python
function calls take extra code and slows function calls.
math.sin, for instance, is a fast-as-possible wrapper around the C math
library sin function. It extracts the C double from the Python float,
calls C sin, and returns the returned C double wrapped as a Python
float. Coredevs decided that being able to call math.sin(x=.33333) is
not worth the resulting slowdown. I am rather sure that heavy users of
the math module would agree.
--
Terry Jan Reedy
More information about the Python-list
mailing list