Syntax

This chapter mainly introduces the syntax of DolphinDB Python Parser, covering statements, function definitions, and so on. Python Parser shares the same syntax as Python in identifiers, reserved words, lines and indentation, multiline statements, numeric types, strings, empty lines, output printing, and so on. Their differences will be elaborated upon in the following sections.

Note:

  • Python Parser's support for comprehension limits to lists.

  • Python Parser does not support generator expressions.

  • Python Parser can only print data to standard output (stdout). Specifying a destination or format for the output, or reading from standard input (stdin) are not supported.

  • Python Parser encapsulates DolphinDB functions with the same name as Python's built-in functions as well as DolphinDB's constant objects in the dolphindb package. It is necessary to import the dolphindb package before calling these functions and objects.

  • Positional parameters (/), asterisk parameters (* and **), defining a class inside a function, or using the import statement inside a function are not supported in function definitions.