Skip to content

Commit a54df1c

Browse files
committed
Merge branch 'CarstenGrohmann-Typos'
2 parents 40b2ef9 + ea92ecc commit a54df1c

File tree

10 files changed

+1126
-1115
lines changed

10 files changed

+1126
-1115
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Python in the browser, precompiled for speed: https://www.transcrypt.org
1212
- Debug directly from Python sourcecode, through integrated sourcemaps
1313
- Generates JavaScript for humans, resembling the Python source line by line, optionally annotated with source line numbers
1414
- Lightning fast JavaScript 6 code: call caching, for-loop optimization, in-line JavaScript etc.
15-
- Integrated static typechecking and minification at the tip of a command line switch
15+
- Integrated static type checking and minification at the tip of a command line switch
1616
- Also runs on top of node.js
1717
- Extensive documentation with many code examples
1818
- Apache 2.0 license
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
The main differences with CPython
2-
=================================
3-
4-
Differences due to the compiled, rather than interpreted nature of Transcrypt
5-
-----------------------------------------------------------------------------
6-
7-
- Since Transcrypt is precompiled on the development machine, Python's exec and eval are not supported, but JavaScript's eval is.
8-
- C++ style conditional compilation is supported through :ref:`pragmas <pragma_ifdef>`.
9-
- Conditional import of modules is done by using conditional compilation rather than conditional statements.
10-
- Source level debugging in the browser is available through the use of sourcemaps.
11-
- Running a compiled Transcrypt program doesn't require a Python or Transcrypt interpreter. It only requires the runtime, which is about 40 kB.
12-
13-
Differences due to the 'lean and mean' design goal
14-
--------------------------------------------------
15-
16-
- Facilities like operator overloading, automatic truth value conversion and named parameters can be switched on and off locally using pragmas, to keep the generated code small.
17-
- Interpreting negative indices as offsets from the end of a list or string requires operator overloading to be switched on.
18-
- String formatting is done through the *format* method or through f-strings, as this is considered most flexible. Using % for formatting isn't supported.
19-
- Some methods of container types like list, set and dict, that duplicate functionality of other methods, have been left out of the core libraries. If needed they can be supplied in separate libraries.
20-
- Metaclasses only support overloading the __new__ method, covering 90% of the use cases.
21-
- Currently the \*, /, //, +, -, @, [], (), ==, !=, <, <=, >, >=, \*\*, << and >> operators can be overloaded, both forward and reverse where appropriate, covering almost all usecases.
22-
- The 'with' statement can currently only be used for file-like objects.
23-
24-
Differences due to interoperability with JavaScript and JavaScript libraries
25-
----------------------------------------------------------------------------
26-
27-
- Python objects, functions and methods and their JavaScript counterparts can in general be mixed freely without special syntax.
28-
- To be able to use JSON-like syntax in configuring JavaScript libraries, Transcrypt dicts are in fact JavaScript objects. Attribute keys that may denote a number are interpreted as such, all others are interpreted as strings.
29-
- Any amount of literal JavaScript can be included in-line or from a separate file using :ref:`\_\_pragma\_\_ ('js', ..., ...) <pragma_js>`.
30-
- The *print* function can be used to print to a DOM element or to the browser console.
31-
- The methods *console.dir* and *console.log* are also available when programming for the browser, as are in fact all JavaScript facilities, including the complete DOM-manipulation API.
32-
- Certain identifiers are reserved in JavaScript. In most cases they still can be used in Transcrypt, since they are aliased to other identifiers. Identifiers and directory keys starting with *py\_* are to be avoided, since many of them have special meaning in Transcrypt. It would have been possible to make clashes even more rare, by using e.g. @ and \_\_ in but this would have made the JavaScript code harder to read. Note that you can define a local alias yourself if you still want to use a reserved identifier.
33-
- The name *type* cannot be used as an ordinary identifier.
34-
- You can use *require* to load JavaScript modules on the fly and access them just as you would from JavaScript.
35-
36-
Differences due to running Transcrypt applications in the browser, rather than on the desktop
37-
---------------------------------------------------------------------------------------------
38-
39-
- Transcrypt doesn't directly support the use of libraries written in C or C++ since, without special measures like compiling to asm.js, C and C++ don't run in the browser.
40-
- The browser programming model is event driven, so Transcrypt programs are even driven, as are their JavaScript counterparts.
41-
- Just like JavaScript, Transcrypt running in the browser cannot write to an ordinary disk file, due to security limitations. However, just like JavaScript, it can store and retrieve data using JSON and Ajax.
42-
1+
The main differences with CPython
2+
=================================
3+
4+
Differences due to the compiled, rather than interpreted nature of Transcrypt
5+
-----------------------------------------------------------------------------
6+
7+
- Since Transcrypt is precompiled on the development machine, Python's exec and eval are not supported, but JavaScript's eval is.
8+
- C++ style conditional compilation is supported through :ref:`pragmas <pragma_ifdef>`.
9+
- Conditional import of modules is done by using conditional compilation rather than conditional statements.
10+
- Source level debugging in the browser is available through the use of sourcemaps.
11+
- Running a compiled Transcrypt program doesn't require a Python or Transcrypt interpreter. It only requires the runtime, which is about 40 kB.
12+
13+
Differences due to the 'lean and mean' design goal
14+
--------------------------------------------------
15+
16+
- Facilities like operator overloading, automatic truth value conversion and named parameters can be switched on and off locally using pragmas, to keep the generated code small.
17+
- Interpreting negative indices as offsets from the end of a list or string requires operator overloading to be switched on.
18+
- String formatting is done through the *format* method or through f-strings, as this is considered most flexible. Using % for formatting isn't supported.
19+
- Some methods of container types like list, set and dict, that duplicate functionality of other methods, have been left out of the core libraries. If needed they can be supplied in separate libraries.
20+
- Metaclasses only support overloading the __new__ method, covering 90% of the use cases.
21+
- Currently the \*, /, //, +, -, @, [], (), ==, !=, <, <=, >, >=, \*\*, << and >> operators can be overloaded, both forward and reverse where appropriate, covering almost all use cases.
22+
- The 'with' statement can currently only be used for file-like objects.
23+
24+
Differences due to interoperability with JavaScript and JavaScript libraries
25+
----------------------------------------------------------------------------
26+
27+
- Python objects, functions and methods and their JavaScript counterparts can in general be mixed freely without special syntax.
28+
- To be able to use JSON-like syntax in configuring JavaScript libraries, Transcrypt dicts are in fact JavaScript objects. Attribute keys that may denote a number are interpreted as such, all others are interpreted as strings.
29+
- Any amount of literal JavaScript can be included in-line or from a separate file using :ref:`\_\_pragma\_\_ ('js', ..., ...) <pragma_js>`.
30+
- The *print* function can be used to print to a DOM element or to the browser console.
31+
- The methods *console.dir* and *console.log* are also available when programming for the browser, as are in fact all JavaScript facilities, including the complete DOM-manipulation API.
32+
- Certain identifiers are reserved in JavaScript. In most cases they still can be used in Transcrypt, since they are aliased to other identifiers. Identifiers and directory keys starting with *py\_* are to be avoided, since many of them have special meaning in Transcrypt. It would have been possible to make clashes even more rare, by using e.g. @ and \_\_ in but this would have made the JavaScript code harder to read. Note that you can define a local alias yourself if you still want to use a reserved identifier.
33+
- The name *type* cannot be used as an ordinary identifier.
34+
- You can use *require* to load JavaScript modules on the fly and access them just as you would from JavaScript.
35+
36+
Differences due to running Transcrypt applications in the browser, rather than on the desktop
37+
---------------------------------------------------------------------------------------------
38+
39+
- Transcrypt doesn't directly support the use of libraries written in C or C++ since, without special measures like compiling to asm.js, C and C++ don't run in the browser.
40+
- The browser programming model is event driven, so Transcrypt programs are also event driven, as are their JavaScript counterparts.
41+
- Just like JavaScript, Transcrypt running in the browser cannot write to an ordinary disk file, due to security limitations. However, just like JavaScript, it can store and retrieve data using JSON and Ajax.
42+

0 commit comments

Comments
 (0)