Python vs C for a mail server

Alex Martelli aleax at mail.comcast.net
Sun Jan 29 19:28:20 EST 2006


Paul Boddie <paul at boddie.org.uk> wrote:
   ...
> The context was whether you can know before running the program whether
> the function you're attempting to call exists, along with where it is
> defined. Obviously, it's a struggle to think of cases where one would
> do this for the sake of it (especially with hard-coded string
> literals), but where one wants to take some value (eg. a class name)
> and dispatch to some callable (eg. some visitor handler method) based
> on that dynamic information, it's a useful technique. Whether
> widespread usage of such a technique counts as advocacy is a matter I
> don't find particularly interesting to discuss.
> 
> Or should I be looking for some other context here?

The context is: can any other language be different in this respect?
Only by not allowing *any* way to get symbols dynamically, and therefore
by substantially reducing the real-world cases in which it's usable.
C++ (with dlopen/dlsym and equivalent libraries on other platforms, with
dynamic_cast, ...) and Java (with 'reflection' etc) do afford this
functionality, albeit in more cumbersome ways than Python.  Therefore,
if the inability to verify that a function named 'foobar' is in fact
never called anywhere is a weakness, it's a weakness shared by all of
these languages.  The originator of this thread appeared to assume that
it was a weakness of Python and not of C++...


Alex



More information about the Python-list mailing list