builtins.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. Builtin functions and exceptions
  2. ================================
  3. All builtin functions and exceptions are described here. They are also
  4. available via ``builtins`` module.
  5. Functions and types
  6. -------------------
  7. .. function:: abs()
  8. .. function:: all()
  9. .. function:: any()
  10. .. function:: bin()
  11. .. class:: bool()
  12. .. class:: bytearray()
  13. .. class:: bytes()
  14. |see_cpython| `python:bytes`.
  15. .. function:: callable()
  16. .. function:: chr()
  17. .. function:: classmethod()
  18. .. function:: compile()
  19. .. class:: complex()
  20. .. function:: delattr(obj, name)
  21. The argument *name* should be a string, and this function deletes the named
  22. attribute from the object given by *obj*.
  23. .. class:: dict()
  24. .. function:: dir()
  25. .. function:: divmod()
  26. .. function:: enumerate()
  27. .. function:: eval()
  28. .. function:: exec()
  29. .. function:: filter()
  30. .. class:: float()
  31. .. class:: frozenset()
  32. .. function:: getattr()
  33. .. function:: globals()
  34. .. function:: hasattr()
  35. .. function:: hash()
  36. .. function:: hex()
  37. .. function:: id()
  38. .. function:: input()
  39. .. class:: int()
  40. .. classmethod:: from_bytes(bytes, byteorder)
  41. In MicroPython, `byteorder` parameter must be positional (this is
  42. compatible with CPython).
  43. .. method:: to_bytes(size, byteorder)
  44. In MicroPython, `byteorder` parameter must be positional (this is
  45. compatible with CPython).
  46. .. function:: isinstance()
  47. .. function:: issubclass()
  48. .. function:: iter()
  49. .. function:: len()
  50. .. class:: list()
  51. .. function:: locals()
  52. .. function:: map()
  53. .. function:: max()
  54. .. class:: memoryview()
  55. .. function:: min()
  56. .. function:: next()
  57. .. class:: object()
  58. .. function:: oct()
  59. .. function:: open()
  60. .. function:: ord()
  61. .. function:: pow()
  62. .. function:: print()
  63. .. function:: property()
  64. .. function:: range()
  65. .. function:: repr()
  66. .. function:: reversed()
  67. .. function:: round()
  68. .. class:: set()
  69. .. function:: setattr()
  70. .. class:: slice()
  71. The *slice* builtin is the type that slice objects have.
  72. .. function:: sorted()
  73. .. function:: staticmethod()
  74. .. class:: str()
  75. .. function:: sum()
  76. .. function:: super()
  77. .. class:: tuple()
  78. .. function:: type()
  79. .. function:: zip()
  80. Exceptions
  81. ----------
  82. .. exception:: AssertionError
  83. .. exception:: AttributeError
  84. .. exception:: Exception
  85. .. exception:: ImportError
  86. .. exception:: IndexError
  87. .. exception:: KeyboardInterrupt
  88. .. exception:: KeyError
  89. .. exception:: MemoryError
  90. .. exception:: NameError
  91. .. exception:: NotImplementedError
  92. .. exception:: OSError
  93. |see_cpython| `python:OSError`. MicroPython doesn't implement ``errno``
  94. attribute, instead use the standard way to access exception arguments:
  95. ``exc.args[0]``.
  96. .. exception:: RuntimeError
  97. .. exception:: StopIteration
  98. .. exception:: SyntaxError
  99. .. exception:: SystemExit
  100. |see_cpython| `python:SystemExit`.
  101. .. exception:: TypeError
  102. |see_cpython| `python:TypeError`.
  103. .. exception:: ValueError
  104. .. exception:: ZeroDivisionError