The slash "/" as used in the documentation

Chris Angelico rosuav at gmail.com
Sun Feb 10 10:34:24 EST 2019


On Mon, Feb 11, 2019 at 2:21 AM Jon Ribbens <jon+usenet at unequivocal.eu> wrote:
>
> On 2019-02-09, Terry Reedy <tjreedy at udel.edu> wrote:
> > '/' is no uglier than, and directly analogous to, and as easy to produce
> > and comprehend, as '*'.  It was selected after considerable discussion
> > of how to indicate that certain parameters are, at least in CPython,
> > positional only.  The discussion of options included at least some of
> > those given above.  It is very unlikely to go away or be changed.
>
> Ok, but what does it *mean*?

It means "everything prior to this point is positional-only".

> As an aside, how is 'math.sin' actually implemented? mathmodule.c
> refers to the function 'math_sin' but that name is not defined
> anywhere in the Python source code. I'm a bit mystified as to how
> CPython manages to compile!

A lot of those sorts of functions are hyperthin wrappers around the C
math library. A bit of digging takes me to line 1176 of mathmodule.c
(in my source tree; exact line number may vary), which uses the
#define of FUNC1 from line 1032, and the actual code is up at line
876, with a good block comment.

ChrisA



More information about the Python-list mailing list