Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python object construction not straightforward #120

Closed
ma-laforge opened this issue Mar 12, 2015 · 2 comments
Closed

Python object construction not straightforward #120

ma-laforge opened this issue Mar 12, 2015 · 2 comments

Comments

@ma-laforge
Copy link

After running a few tests, it appears there are 2 ways to construct an object.
Let us assume a python module was imported in Julia:

@pyimport MyModule as mm

  1. If your Python object is derived from "object", you get the nice call syntax:

Python:

class MyObj1(object): ...

Julia:

mm.MyObj1([constructor args...])

  1. If your Python object is not derived from "object", the syntax is not as nice:

Python:

class MyObj2(): ...

Julia:

pycall(mm.MyObj2, PyObject, [constructor args...])

My experiments show the two constructor syntaxes cannot be interchanged.

Though a little confusing, this is not so bad. It might be nice to have it mentioned in README.md.

Great module!

@stevengj
Copy link
Member

This difference will go away in Julia 0.4 once I can make all PyObjects callable, I think (see #101).

@ma-laforge
Copy link
Author

Sounds good to me. I guess I will close the issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants