safer ctype? (was GUIs - A modest Proposal)

Stephen Hansen me+list/python at ixokai.io
Sun Jun 13 02:29:49 EDT 2010


On 6/12/10 8:42 PM, Gregory Ewing wrote:
> Stephen Hansen wrote:
> 
>> Its one thing for Python to make available foot-shooting tools(this is
>> good! I love ctypes, with care) for the developer, its another thing
>> entirely for it to shoot at the ground in the normal course of its
>> operation and hope it doesn't blow off any big toes. :)
> 
> I would hope that a module included in the stdlib was written
> by a sufficiently skilled marksman that it can successfully
> carry out ground-targeting without loss of appendages. And I'd
> better stop before this metaphor undergoes a sudden catastrophic
> stress fracture.

Wow, I had difficulty taking the metaphor as far as I did. I bow to you,
sir! :)

> Seriously, though, if you can't trust someone to write safe
> ctypes-using code, can you trust them to write safe C code any
> better? Especially considering that the equivalent C code is
> much longer and more tedious to write, with attendant risk of
> the author losing concentration and making a mistake.

I don't disagree at all; in fact I consider the use of ctypes entirely
fine, if the devs doing it take sufficient care.

But I do get the point of the policy, even though in certain cases --
namely, win32 api access -- it pains me and I wish there could be a
middle-way which gave me the best of both worlds.

If ctypes is in place, then anything can use ctypes. Clearly, that stuff
which may make it into the stdlib will be best of breed from a safety
stand point, and they're using ctypes just as a maintenance relief and
not due to lack of ability or knowledge.

But now -everything- has access to ctypes. And that's sort of dangerous.
I've been in environments where corporate / security interests were such
that they'd like to /not/ have ctypes, as the safety of Python was a key
selling point. Removing ctypes preserves that safety. But you can't have
the stdlib breaking then, with only certain parts working.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20100612/8b6268c9/attachment.sig>


More information about the Python-list mailing list