[issue8939] Use C type names (PyUnicode etc;) in the C API docs

STINNER Victor report at bugs.python.org
Wed Jun 9 11:28:32 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Le mercredi 09 juin 2010 11:06:25, vous avez écrit :
> >  - replace Python types by C Python types (eg. str => PyUnicodeObject*
> >  and None => Py_None)
> 
> I was thinking of e.g. "PyUnicode", not "PyUnicodeObject*".

I don't know PyUnicode, only "unicode" (Python type) or "PyUnicodeObject*" (C 
Python type). :ctype:`PyUnicodeObject*` creates a link in the HTML 
documentation.

> >  - add quotes to the formats, eg. s => "s"
> 
> Why do you put the parser codes in double quotes ?

It's easier to search a format: try to search s or b format in the current 
documentation, you will see :-)

I think that it's also more readable and closer to the "real" source code (eg. 
a call to PyArg_ParseTuple() uses quotes).

> >  - replace true by 1, and false by 0 (C API of Python doesn't use
> >  stdbool.h but classic int)
> 
> That's not necessarily correct: true in C means non-zero. Only
> false equates to 0. You can however, make that change if the
> function actually does always return 1.

There are only 2 possible results: 0 or 1.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8939>
_______________________________________


More information about the Python-bugs-list mailing list