Git Product home page Git Product logo

Comments (4)

ivarne avatar ivarne commented on June 18, 2024

What would the benefit be?

If you are going to have a python class wrapped in a julia type, I can not see how you would avoid having to call a py_update(obj::py_wrapped_type) function on the type before accessing any of the fields. Without that there is no hook in julia to intercept the access and ask python what the value is now.

from pycall.jl.

malmaud avatar malmaud commented on June 18, 2024

The point is wrapping the return value of some Python function calls as a Julia native composite type, just like PyPlot wraps matplotlib's Figure class.

from pycall.jl.

malmaud avatar malmaud commented on June 18, 2024

I definitely wasn't thinking that there would be synchronization between the wrapped Julia representation of a Python object and the object's attributes in the Python runtime.

from pycall.jl.

diegozea avatar diegozea commented on June 18, 2024

I was thinking maybe in a julian keyword for @pyimport, or something similar, which create a Julia type for Python class and methods applied to this class in a Julian way.

Now:

@pyimport Bio.Seq as s
@pyimport Bio.Alphabet as a
my_dna = s.Seq("AGTACACTGGT", a.generic_dna)
my_dna[:find]("ACT")

This idea:

@pyimport julian from Bio.Seq import Seq
@pyimport Bio.Alphabet as a
my_dna = Seq("AGTACACTGGT", a.generic_dna)
find(my_dna,"ACT")

I don't have any idea about how implement it, but maybe we can use something like this (?):

>>> [method for method in dir(Seq) if callable(getattr(Seq, method))]
['__add__', '__class__', '__cmp__', '__contains__', '__delattr__', '__format__', '__getattribute__', '__getitem__', '__hash__', '__init__', '__len__', '__new__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_get_seq_str_and_check_alphabet', 'back_transcribe', 'complement', 'count', 'endswith', 'find', 'lower', 'lstrip', 'reverse_complement', 'rfind', 'rsplit', 'rstrip', 'split', 'startswith', 'strip', 'tomutable', 'tostring', 'transcribe', 'translate', 'ungap', 'upper']

from pycall.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.