-
Notifications
You must be signed in to change notification settings - Fork 189
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
More flexible pyimport syntax. Fixes #66 #329
Conversation
Current coverage is 63.56% (diff: 88.23%)@@ master #329 diff @@
==========================================
Files 14 14
Lines 1259 1279 +20
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 794 813 +19
- Misses 465 466 +1
Partials 0 0
|
How does this handle "merge conflicts", i.e. if the imported function is already defined? I have a growing sense that |
@pyimport math: sin
> Cannot @pyimport sin. It is already defined in the current module.
I see what you mean. The new syntax doesn't rely on the @pyimport sklearn.linear_model: (LinearRegression, LogisticRegression) I'm OK with taking it out of PyCall, but I will keep it alive elsewhere in my codebase, as I find it rather elegant. |
We could always support LinearRegression, LogisticRegression = pyimport("sklearn.linear_model")[:LinearRegression, :LogisticRegression] by special-casing a tuple of symbols in |
Another option would be to unexport it and take it out of the README. |
The migration path would be to |
That's fine for me. I'm already providing this PR's macro in ScikitLearn.jl, because it makes my examples look friendlier for people coming from Python. I can keep doing that. |
(If Julia would just get dot overloading already then this would be mostly moot, grrr.) |
No description provided.