pyccel.codegen.printing.pycode module#

class pyccel.codegen.printing.pycode.PythonCodePrinter(filename, *, verbose)[source]#

Bases: CodePrinter

A printer for printing code in Python.

A printer to convert Pyccel’s AST to strings of Python code. As for all printers the navigation of this file is done via _print_X functions.

Parameters:
  • filename (str) – The name of the file being pyccelised.

  • verbose (int) – The level of verbosity.

get_type_checks(arg_code, class_type)[source]#

Get the code to check if an argument has the expected type.

Get the code to check if an argument has the expected type. This is used in an if block to select the right code to run.

Parameters:
  • arg_code (str) – The code describing the argument being checked.

  • class_type (PyccelType) – The expected type.

Returns:

A list containing the checks that must be satisfied for the type to be considered matching.

Return type:

list[str]

language = 'python'#
printmethod = '_pycode'#