Python mode
() [] {} , : ` = ; @ . # Note that @ and . require the proper context.1
# Literals2
12343
0.0e1014
.1235
0b010100111006
0o012345677
0x0987654321abcdef8
79
214748364710
3L11
79228162514264337593543950336L12
0x100000000L13
7922816251426433759354395033614
0xdeadbeef15
3.14j16
10.j17
10j18
.001j19
1e100j20
3.14e-10j21
22
23
# String Literals24
'For\''25
"God\""26
"""so loved27
the world"""28
'''that he gave29
his only begotten\' '''30
'that whosoever believeth \31
in him'32
''Cython mode
22
1
2
import numpy as np3
cimport cython4
from libc.math cimport sqrt5
6
(False)7
(False)8
def pairwise_cython(double[:, ::1] X):9
cdef int M = X.shape[0]10
cdef int N = X.shape[1]11
cdef double tmp, d12
cdef double[:, ::1] D = np.empty((M, M), dtype=np.float64)13
for i in range(M):14
for j in range(M):15
d = 0.016
for k in range(N):17
tmp = X[i, k] - X[j, k]18
d += tmp * tmp19
D[i, j] = sqrt(d)20
return np.asarray(D)21
22
Configuration Options for Python mode:
- version - 2/3 - The version of Python to recognize. Default is 2.
- singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.
- hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much that line should be indented. Defaults to one normal indentation unit.
Advanced Configuration Options:
Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help
- singleOperators - RegEx - Regular Expression for single operator matching, default :
^[\\+\\-\\*/%&|\\^~<>!]
- singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :
^[\\(\\)\\[\\]\\{\\}@,:`=;\\.] - doubleOperators - RegEx - Regular Expression for double operators matching, default :
^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))
- doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default :
^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))
- tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default :
^((//=)|(>>=)|(<<=)|(\\*\\*=))
- identifiers - RegEx - Regular Expression for identifier, default :
^[_A-Za-z][_A-Za-z0-9]*
- extra_keywords - list of string - List of extra words ton consider as keywords
- extra_builtins - list of string - List of extra words ton consider as builtins
MIME types defined: text/x-python and text/x-cython.
