4

Like we have python modules in the standard library from which we can import methods and use them, is there also a module where all the built-in functions are defined? If yes, how can I view that module?

Rishu
  • 95
  • 1
  • 5

2 Answers2

0

On python3, import builtins or import __builtin__ for older versions

You can check any modules content with the dir function

JBernardo
  • 32,262
  • 10
  • 90
  • 115
0

The builtins (Python 3) or __builtin__ (Python 2) module provides access to them.

This is even useful sometimes if you rebind the name of a builtin, eg list = [1, 2, 3]. You generally shouldn't do that, but if you do you can still access the builtin list constructor as builtins.list.

Peter DeGlopper
  • 36,326
  • 7
  • 90
  • 83