Python Productivity over C++

Mike Steed MSteed at altiris.com
Fri Jun 9 13:39:38 EDT 2000


> From: wlav at atlas03.cern.ch [mailto:wlav at atlas03.cern.ch]
> Sent: Friday, June 09, 2000 11:11 AM
> To: python-list at python.org
> Subject: Re: Python Productivity over C++
> 
> 
> Mike Steed <MSteed at altiris.com> writes:
> >> From: nbecker at fred.net [mailto:nbecker at fred.net]
> >> 
> >> I rarely need to do this for my classes.  Using STL heavily is a big
> >> help.
> 
> >This is a surprising thing to say.  STL requires that the types used to
> >instantiate its various templates be well-behaved in certain ways, e.g.,
for
> >copying, assigning, and comparing (depending on the "concept" to which
the
> >template conforms).
> 
> All that STL containers require is that your dtor and copy assignment
> don't throw. The compiler generated members fullfill that requirement.

True.  And although it's not required, it *is* a good idea to make sure that
each class's copy constructor and assignment operator behave properly.  The
default copy ctor often does not do what you want, e.g., if your class
contains pointers to other objects.
 
> >  This means you have to implement your own copy
> >constructor, assignment operator, and/or comparison operators for each
> >(non-trivial) class.  It may not be difficult, but it is overhead that
> >Python does not impose.
> 
> Please inform yourself better before making such statements. Blindlessy
> drawing conclusions based on the C++ implementation of one particular
> vendor from Redmond isn't good for your credability.

And assuming that I'm blindlessly drawing conclusions based on Microsoft's
compiler is not good for your credibility.  The default copy ctor
(regardless of the compiler) simply does a member-by-member copy, which is
often the wrong thing to do.  The point is that, even if the default is
acceptable, the C++ programmer has to (or should) think about it.

This discussion illustrates the original point: these are details that the
Python programmer does not need to deal with.

> Best regards,
>       Wim Lavrijsen

--
M.




More information about the Python-list mailing list