[bind10-dev] single vs multi module for libdns++ python binding

Shane Kerr shane at isc.org
Wed Aug 25 19:04:49 UTC 2010


Jinmei,

On Tue, 2010-08-24 at 11:57 -0700, JINMEI Tatuya / 神明達哉 wrote:
> When I wrote python binding for a new class of libdns++, this question
> arose: "why do we use a single giant python module (currently named
> 'libdns_python')"?
> 
> For comparison, dnspython uses multiple (sub)modules for "message",
> "name", "rrset", etc.  And, I felt it might be more convenient if we
> want to define module specific functions (which are not class
> methods).  It may also help separate the binding C++ source files per
> functionality (= python "module").  On the other hand, if we want to
> keep 1-to-1 relationship between C++ namespaces and python modules, I
> see it makes sense to use the single, flat module (although I'm not
> sure if there's a pragmatic benefit by having this relationship).
> 
> Is there any specific design decision on this point, or is this
> something worth discussing?

While I think the reasons Jelte outlined are the most important, I'd
like to throw in a point of personal preference.

For me, forcing the developer to figure out which modules are needed out
of a set rather than providing a single one is somewhat annoying. For a
late-binding language like Python, it can also be dangerous.

There was a time in Windows when you could write a C simple program by
using only the following header:

#include <windows.h>

Contrariwise, to write a simple Unix program you end up with something
like:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>

Again, not a big deal, but I tend to think it's easier to use a combined
library...

--
Shane




More information about the bind10-dev mailing list