[Python-3000] PyObject_AsString()

Guido van Rossum guido at python.org
Sun Dec 2 18:24:41 CET 2007


On Nov 22, 2007 2:30 AM, Christian Heimes <lists at cheimes.de> wrote:
> Amaury Forgeot d'Arc wrote:
> > Could this code replace the current PyString_AsStringAndSize, instead
> > of creating a new function?
>
> I guess it could. But it's a naming question. The method is more general
> and takes more than just instances of PyString and its subclasses.
> Therefor I think it should be part of the abstract protocol. Guido? :)

(Did I reply to this before? Can't remember. Getting old. :-)

Personally I think we should get rid of all this attempts at
micro-optimizations (most of which don't buy enough time to matter but
bloat the code), and just use the buffer API exclusively. The buffer
API can't replace PyString_AsStringAndSize since it requires a cleanup
call when you're done. Ideally that API disappears completely -- in
practice there are too many occurrences and the refactoring is a bit
complex to do automatically.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list