[OT] fortran lib which provide python like data type

Michael Torrie torriem at gmail.com
Fri Jan 30 19:15:12 CET 2015


On 01/30/2015 10:31 AM, Rustom Mody wrote:
> And what about the grey area between lightweight and heavyweight?

That's what the smart pointers are for.

> You say just use copy constructors and no pointers.
> Can you (ie C++) guarantee that no pointer is ever copied out of 
> scope of these copy-constructed objects?

If that happened, then it's because you the programmer wanted it to
happen.  It's not just going to happen all by itself.  Yes anytime
pointers are allowed, things are potentially unsafe in the hands of a
programmer.  I'm just saying it's not nearly so bad as you make it out
to be.  Follow basic rules and 99% of segfaults will never happen and
the majority of leaks will not happen either.

Python can still leak badly if a programmer causes it to.  As for
segfaulting, no your python code should not itself segfault.  C++ code
certainly could.  Exposing pointers to the programmer can be very
powerful (and necessary... cannot write a bare-metal OS in common
Python) but the programmer can screw it up too on occasion.



More information about the Python-list mailing list