Beginner: How to copy a string?

dbrown2 at yahoo.com dbrown2 at yahoo.com
Mon Apr 7 21:19:08 EDT 2003


Thanks for the clear and concise answer.  It would likely take me a
long time if ever to understand this point on my own looking through
written docs.  Gotta love comp.lang.python and it's inhabitants!

It looks like I'm done copying strings (or at least trying).  I'm a
convert.  In fact, just wait 'til someone asks this question again.  I
hope I can be the first in line to show utter shock at the silly
notion. ;-)

Regards,

David


Peter Hansen <peter at engcorp.com> wrote in message news:<3E8CF439.D4D48B8A at engcorp.com>...

>clip...
> Excellent try, but I'm afraid it wouldn't work that way (unless someone
> really devious deliberately tried to break how things should work).
> The data returned by the external library, in order to be interfaced to 
> Python, would have to create a *Python* string using calls into the 
> Python interpreter (see http://www.python.org/doc/current/ext/ext.html
> for more on this sort of thing).  Python would already have copied the
> external data into a new area, which would then be preserved forever
> in the face of everyone's futile :-) attempts to copy it.
> 
> So long as Python strings are not exposed via a pointer to some 
> malicious external routine, I doubt you'll ever need to worry about
> the copying thing, but I salute your attempt!
> 
> -Peter




More information about the Python-list mailing list