[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python bindings

From: Lele Gaifax <lele_at_nautilus.homeip.net>
Date: 2004-05-12 17:36:29 CEST

>>>>> "C" == C Michael Pilato <cmpilato@collab.net> writes:

    C> Lele, I get the sense that you haven't actually tried to
    C> implement Subversion bindings in Python.

That may come only from my inadeguate english knowledge, since as you
later state, I've already been there and found the glitches.

Whatever sense you may have, I do not think you are fair, here. For
the very last time, I ask you a little trust on my knowledge on
this. If you can't grant that, well, we just lost some time.

    C> Step 2 even works, sorta. svn_config_get_config() returns a
    C> SWIG pointer object that represents an apr_hash_t. Here's
    C> where problems start to show up. See, for passing ctx into
    C> interfaces that need it, this is perfect because so far it only
    C> contains easily-mappable native types and SWIG pointer objects.
    C> But that means we can't modify ctx.config as a dictionary
    C> object from inside Python.

    C> Of course, we instead write svn_config_get_config so that it
    C> returns a Python dictionary instead of a SWIG apr_hash_t
    C> pointer, we get the opposite effect -- modifying the returned
    C> config in Python will be mindless, but any Subversion
    C> interfaces expecting ctx.config to be an apr_hash_t will
    C> instead find a Python dictionary object.

Ah, you see? Everything's done with SWIG end with this kind of
approach of having some (two, at least) functions that "convert"
internal data to/from the target language objects. For *each* new
datum type, you have then two functions *per* language, that do
whatever is needed.

With Pyrex, there's *no* need to follow that crazyness, as it allows
you to **easily** build native Python classes that wrap the needed
types, so that for example you can expose the *real* apr_hash as a
standard dictionary, gaining the two-way capability. Not having that,
is by all means a SWIG artifact.

    C> I should also state that I know nothing of Pyrex.

I'm even able to find all this funny, expecially when you insist that
*I* do not know the matter enough to speak a different voice.

    C> So go do the work (and by all means, please end this thread).

Sure, sorry again for the distraction. Won't spend another 0.01€ on
sponsoring possible better ways of doing something, here.

ciao, lele.

nickname: Lele Gaifax	| Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas	| comincerò ad aver paura di chi mi copia.
email: lele@seldati.it	|		-- Fortunato Depero, 1929.
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 12 17:36:48 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.