Why is python not written in C++ ?

Aahz aahz at pythoncraft.com
Tue Aug 3 00:05:29 EDT 2010


In article <2b473423-0a22-4f4d-943f-31ea2d6020e6 at z10g2000yqb.googlegroups.com>,
sturlamolden  <sturlamolden at yahoo.no> wrote:
>
>And since this is comp.lang.python, I'll add in that this sometimes
>applies to Python as well. Python, like C++, can have the call stack
>rewinded by an exception. If we call some raw OS resource allocation,
>e.g. malloc or fopen using ctypes, we have to place a deallocation in
>__del__ (and make sure the object is newer put in a reference cycle).
>The safer option, however, is to use a C extension object, which is
>guaranteed to have the destructor called (that is, __dealloc__ when
>using Cython or Pyrex).

Actually, with Python 2.6 or later, the Pythonic solution is to use
``with``.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"....Normal is what cuts off your sixth finger and your tail..."  --Siobhan



More information about the Python-list mailing list