Skip to content

Porting JavaScript to Python

Nick Chapman edited this page Jan 19, 2018 · 6 revisions

Porting JavaScript to Python

JavaScript and Python aren't exactly the same, but they're also not that different. To start we are attempting to mirror the existing JavaScript codebase as closely as we can. This is done so that users can switch between the two seamlessly.

Python vs JavaScript Method Names

There are some code formatting rules in Python that are different from JavaScript. For this project the most notable will likely be the difference in method names:

JavaScript (well really TypeScript)
----------

public getSomething() {
    // Do something here
}


Python
----------
def get_something():
    # Do something here

Python uses snake case while all of the existing Request code is in camel case. For now we are going to keep the camel case names to speed the process of porting over code. At a later date and time we will refactor all of the method names to become PEP-8 compliant.

Optional arguments

Optional arguments in the JavaScript methods should be carried over to Python as key word arguments.

Clone this wiki locally