[gt-users] extending python bindings
Brent Pedersen
bpederse at gmail.com
Tue Nov 25 20:27:25 CET 2008
On Sun, Nov 23, 2008 at 12:03 PM, Sascha Steinbiss
<steinbiss at zbh.uni-hamburg.de> wrote:
> Hi Brent,
>
>> understood, i'll wait for your branch to be merged before i try too
>> much more tinkering. custom track stuff looks cool.
>
> The changes will find their way to the master soon. I guess a tutorial
> on the new features will be ready soon as well.
>
>>> The code looks ok, though the introduction of another FeatureNode
>>> class may be confusing... maybe one could think about extending the
>>> current class to allow for creating new nodes on the C side in
>>> addition to wrapping pointers.
> > i agree, but didnt know what to do. do you mean something like below?
> >
> > class FeatureNode(GenomeNode):
> > __init__(self, *args, **kwargs):
> > if len(args) == 1: # node_ptr
> > # init with pointer
> > else:
> > # init with python attrs
>
> This will work, but I guess I have to look deeper into Python features
> to see if it couldn't be done another way... there is no way to use
> multiple 'constructors' in Python, or is there?
>
not really but there's this:
http://pypi.python.org/pypi/simplegeneric
>> in extended/genome_node.py, why dont you need to declare the args and
>> restype for: gtlib.gt_genome_node_ref or
>> gtlib.gt_genome_node_delete? i dont understand how that is working.
>
> As these C functions are not supposed to be called by a user of the
> wrapped classes, they need no type checking. Per default, a ctypes call
> returns an integer (in this case memory addresses pointing to GenomeNode
> instances), which are then passed to other C functions only. Without the
> need to implicitly convert anything to anything, I kept pushing around
> raw addresses.
>
i see.
>> thanks again, -brent
>
> No problem,
> Sascha
>
> --
> Sascha Steinbiss
> Zentrum für Bioinformatik
> Universität Hamburg
> Bundesstr. 43
> 20146 Hamburg
> Germany
>
> Email: steinbiss at zbh.uni-hamburg.de
> URL: http://www.zbh.uni-hamburg.de/steinbiss
> Phone: +49 (40) 42838 7322
> FAX: +49 (40) 42838 7312
>
> _______________________________________________
> gt-users mailing list
> gt-users at genometools.org
> http://genometools.org/mailman/listinfo/gt-users
>
More information about the gt-users
mailing list