Julia requires to end a block. Unlike Python, Julia has no keyword.
In Julia, indexing of arrays, strings, etc. is 1-based not 0-based.
Julia's slice indexing includes the last element, unlike in Python. in Julia is in Python.
Julia does not support negative indices. In particular, the last element of a list or array is indexed with in Julia, not as in Python.
Julia's , , , etc. blocks are terminated by the keyword. Indentation level is not significant as it is in Python.
Julia has no line continuation syntax: if, at the end of a line, the input so far is a complete expression, it is considered done; otherwise the input continues. One way to force an expression to continue is to wrap it in parentheses.
Julia arrays are column major (Fortran ordered) whereas NumPy arrays are row major (C-ordered) by default. To get optimal performance when looping over arrays, the order of the loops should be reversed in Julia relative to NumPy (see relevant section of Performance Tips).
Julia's updating operators (e.g. , , …) arenot in-placewhereas NumPy's are. This means doesn't change values in , it rather rebinds the name to the result of the right-hand side , which is a new array. For in-place operation, use (see also dot operators), explicit loops, or .
Julia evaluates default values of function arguments every time the method is invoked, unlike in Python where the default values are evaluated only once when the function is defined. For example, the function returns a new random number every time it is invoked without argument. On the other hand, the function returns every time it is called as .
In Julia is the remainder operator, whereas in Python it is the modulus.
领取专属 10元无门槛券
私享最新 技术干货