[Pythonmac-SIG] Living dangerously or not?

Joseph J. Strout joe@strout.net
Thu, 4 Mar 1999 14:29:02 -0800

At 2:03 PM -0800 03/04/99, Jack Jansen wrote:

>If, however, on such a machine
>you subsequently try to call, say, SetMenuKeyModifiers the interpreter
>will happily jump to address 0 and crash. Something similar holds for
>trying to access quicktime 3 functions on a quicktime 2.5 machine, for
>instance. Or on a machine with no quicktime at all:-)


>I _could_ do something about this, by adding code to the bgenned
>modules that checks that the function actually is non-zero before
>trying to call it, but this'll incur an overhead for each and every
>call. And, since noone has yet flamed me this behaviour it has
>apparently gone unnoticed until now, I'm a bit reluctant to put work in
>something that hasn't bothered me, and will make everything slower

There's already quite a bit of overhead for a system call -- probably more
so when it's a shared library function.  Would an additional compare add
that much?  It'd be one assembly instruction, I'd think... "if (func)
func(args); else throwFuncUnavailable();" or some such, right?

I think it'd be better to do it.  One of the chief attractions of Python is
that it's harder to crash your machine in it than in, say, C.  This sounds
like a good opportunity to keep it that way.

If I'm outvoted on this, then we should at least provide, document, and
encourage the use of functions for determining whether certain modules are

-- Joe

|    Joseph J. Strout           Biocomputing -- The Salk Institute |
|    joe@strout.net             http://www.strout.net              |