Comments (4)
Hello!
It would be an interesting feature to add, for sure. Currently, I am a bit delayed in delivering some features I have implemented for Py2Many (you can see my fork here). I am trying to find some time leftover to continue this work, as I believe the community could benefit from this. But I will add this suggestion to the list of things that would be interesting to implement!
from py2many.
Cool! The point here is that this would help to leverage the abilities of Julia concerning generic programming and multiple dispatch.
A function f(x,y)=...
can be easily called with e.g. dual numbers, allowing to differentiate through it, while f(x,y)::Float64
would prevent this possibility. Coming from classical C++/typed languages I also had to unlearn the habit to annotate types everywhere just "to be sure"...
from py2many.
Just to clarify, if there are explicit type annotations in the Python, should they also be removed from the emitted Julia? My guess is you only want the types inferred by py2many to be removed from the output.
It would be very helpful if you could provide a sample input where not emitting the types allows for "better" Julia output.
Another approach to this may be to allow annotating the input Python with type Any
, or a union of allowable types, either explicitly or within py2many, which would tell PyJL that it shouldn't emit a type annotation for a single type.
from py2many.
Thanks for coming back!
I tend to second your clarification, however I am so far not familiar with type annotations in python (switched to Julia before this became a thing...). I guess they are done to help Python to create faster code. If this is true (will try to read up on this), then the situation in Julia is a bit different.
For function calls, basically, Julia autodetects parameter types and emits specialized code without the need of annotation - very much like with a generic C++ header lib. The almost only case where you type-annotate parameters for Julia function is in oder to distinguish different implementations for different types.
For struct entries, the situation is different - here, type annotations are critical for performance.
I will try to come up with a more elaborated example to continue the discussion. May take some time as I am juggling too many balls currently...
from py2many.
Related Issues (20)
- pylib::FileReadString HOT 2
- Split CI to only run individual language tests HOT 1
- Replace auto-cancellation CI
- Win32 test cpp bug
- rust: pow does not work as is HOT 1
- py2many.exceptions.AstUnrecognisedBinOp translating python script HOT 5
- conan2 support
- CI: cargo install cargo-eval fails on Windows HOT 1
- cargo supports scripts directly HOT 2
- Python 3.12 support
- Go tests skipped on Windows as revive not available
- SMT input Python files are not valid Python HOT 1
- Generated exception_names.jl doesnt work HOT 4
- Failure in infer_ops.cpp with g++-13 HOT 1
- cargo -Zscript failing on 1.77 HOT 4
- smt fails with cljstyle-0.16.626.jar manifest does not specify Main-Class HOT 2
- Python deprecation warnings HOT 1
- Flutter pinned to 2.10.5
- New developer experience
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py2many.