A built-in function object is a wrapper around a C function. Examples of built-in functions are len() and math.sin() (math is a standard built-in module). The number and type of the arguments are determined by the C function.
You can browse all the built-in function objects available to us for windows development inside the DelphiVCL library using the Python dir() command:
1 2 3 |
import DelphiVCL dir(DelphiVCL) |
All the built-in function objects are marked with a red rectangle:
Here are the built-in function objects inside the DelphiVCL library and their explanations:
- __doc__: The __doc__ attribute is the module’s or class’s documentation string, the content will be set to None if unavailable.
- __file__: The __file__ attribute is the pathname of the file from which the module was loaded if it was loaded from a file. The __file__ attribute may be missing for certain types of modules, such as C modules that are statically linked into the interpreter; for extension modules loaded dynamically from a shared library, it is the pathname of the shared library file.
- __loader__: The __loader__ attribute must be set to the loader object that the import machinery used when loading the module. This is mostly for introspection but can be used for additional loader-specific functionality, for example getting data associated with a loader.
- __name__: The __name__ attribute must be set to the fully qualified name of the module. This name is used to uniquely identify the module in the import system.
- __package__: The module’s __package__ attribute must be set. Its value must be a string, but it can be the same value as its __name__. When the module is a package, its __package__ value should be set to its __name__. When the module is not a package, __package__ should be set to the empty string for top-level modules, or submodules, to the parent package’s name.
- __spec__: The __spec__ attribute must be set to the module spec that was used when importing the module. Setting __spec__ appropriately applies equally to modules initialized during interpreter startup. The one exception is __main__, where __spec__ is set to None in some cases. When __package__ is not defined, __spec__.parent is used as a fallback.
Let’s run dir() command to all the attributes above:
1 2 3 4 5 6 |
dir(DelphiVCL.__doc__) dir(DelphiVCL.__file__) dir(DelphiVCL.__loader__) dir(DelphiVCL.__name__) dir(DelphiVCL.__package__) dir(DelphiVCL.__spec__) |
See the responses in our Windows command prompt:
Let’s run print() command to all the attributes above:
1 2 3 4 5 6 |
print(DelphiVCL.__doc__) print(DelphiVCL.__file__) print(DelphiVCL.__loader__) print(DelphiVCL.__name__) print(DelphiVCL.__package__) print(DelphiVCL.__spec__) |
See the responses in our Windows command prompt:
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.