[Python-Dev] API bloat

Mark Shannon marks at dcs.gla.ac.uk
Thu Feb 10 18:25:54 CET 2011


Antoine Pitrou wrote:
>> Please, don't just document all these.
>> Don't add them to the API, unless they are really needed.
> 
> We only add functions when they are actually needed (by us, usually).
If only you (I presume you mean the CPython devs) need them,
why put them in the API.
That underscore prefix saves a lot of trouble in the long run ;)

> 
>> I'm not picking on PySys_FormatStderr, or its author here,
>> I'm just using it as an example, it seems fairly typical.
> 
> You've found an exception.

What about this one then,

PyFrame_GetLineNumber was added because people were using 
PyCode_Addr2Line to get the current line number.

The API will contain then both
PyFrame_GetLineNumber *and* PyCode_Addr2Line.
The API then has even more redundancy.

PyObject_GetAttrString(frame, "f_lineno") should do the job.

Mark.

> 
> Antoine.
> 
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/marks%40dcs.gla.ac.uk
> 



More information about the Python-Dev mailing list