[Python-Dev] C++ for CPython 3? (Re: str.count is slow)

Michael Urman murman at gmail.com
Thu Mar 2 03:41:11 CET 2006


On 3/1/06, martin at v.loewis.de <martin at v.loewis.de> wrote:
> There are a few advantages, though, mainly:
> - increased type-safety, in particular for API that isn't type-checked
>   at all at the moment (e.g. PyArg_ParseTuple)

How would this be accomplished - by a function with a ton of optional
templated arguments? By some sort of TupleParser(tuple) >> var1 >>
var2 >> TupleParser::done?

> - more reliable reference counting, due to destructors of local
>   variables

Only true when the rules are consistent with what smart pointers or
the like do. When there's more than a single rule, this goes out the
window because you have to use the correct smart class...

> - "native" exception handling, making exceptions both less error-prone
>   and possible more efficient.

...and exceptions make it impossible to not use smart classes. Since
there isn't a nested level of C for each function call in Python, I
don't see how exceptions in the implementation language would help
exceptions in Python. Do I misunderstand your point, or is there some
really cool trick I'm missing?

(To explain my bias, I'm against the idea of the C++ rewrite as I also
fail to see the advantages outweighing the disadvantages, especially
in light of the amount of rewriting necessary to see the "advantages"
cited so far.)

Michael
--
Michael Urman  http://www.tortall.net/mu/blog


More information about the Python-Dev mailing list