Comments (1)
First, thanks for your interest.
It's redundant in this specific case where *
parameter is named args
but not in the general case:
def spam(*egg, **power):
print egg, power
Will be translated to the following javascript:
var spam = function(args, kwargs) {
var signature, arguments;
signature = {"kwargs": Object(), "args": create_array(), "vararg": "egg", "varkwarg": "power"};
arguments = get_arguments(signature, args, kwargs);
var egg = arguments['egg']; // here the classical *args is named *egg
egg = get_attribute(list, "__call__")(create_array(egg));
var power = arguments["power"];
power = get_attribute(dict, "__call__")(create_array(power));
console.log(egg, power);
}
The compiler is not very smart indeed. But I think it can be improved with javascript compilers like closure. That said pythonscript compiler needs some fixes...
So in your example, it just happens supplemental arguments commonly named *args is already defined before, but in the general case, it's not.
Also there is bug in the code you pasted which is fixed in develop branch, the line you think is redundant is missing an =
sign. This bug was fixed in 7b37946
You can install the development version with the following pip command:
pip install git+https://github.com/PythonScript-/PythonScript.git@develop
from pythonjs.
Related Issues (20)
- Can't subclass from Exception HOT 1
- reload() doesn't work... HOT 3
- C++ backend for Qt prototyping HOT 7
- Support "from module import name1, name2" ?
- print [[0]][0][0]
- f()[0][0]
- Rust Backend
- Safari can't parse 'data.function'
- Int8Array... do not exist in Safari
- ArrayBuffer does not exists in Safari
- HTMLDocument undefined
- Same syntax for all backends , possible? HOT 2
- PythonJS changing to WebPython or WPython?
- How to use python script with web2py project
- Help getting started with --lua HOT 1
- Array append broken
- name 'require' is not defined
- This is a great project, but why it is not update for 2 years?
- AttributeError: 'NoneType' object has no attribute 'endswith'
- H
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 pythonjs.