Python built-in functions (BIF) and pythonbif
As the name suggests, BIF (built-in functions) is an Erlang built-in function. They are usually used to complete tasks that cannot be completed using Erlang. For example, convert the list to a tuples or obtain the current
. The function that completes these operations is called BIF. Python provides a large number of built-in functions, which means you can have less code.
You can enter dir (_ builtins _) in python or IDLE shell to view the python built-in method list. There are two underscores before and after "builtins", and the shell will give
The huge list is as follows:
['Arithmeticerror', 'assertionerror', 'bubuteerror', 'baseexception', 'blockingioerror', 'brokenpipeerror', 'buffererror', 'byteswarning ',
'Childprocessererror', 'ononabortederror ', 'ononerror', 'ononrefusederror', 'connectionreseterror ',
'Descationwarning', 'eoferror', 'ellipsis ', 'environmenterror', 'exception', 'false', 'fileexistserror ', 'filenotfounderror ',
'Floatingpointerror ', 'ureurewarning', 'generatorexit', 'ioerror', 'importererror', 'importwarning', 'indentationerror', 'indexerror ',
'Interruptedererror', 'isadirectoryerror', 'keyerror', 'keyboardinterrupt', 'lookupererror', 'memoryerror', 'nameerror', 'none ',
'Notadirectoryerror', 'notimplemented', 'notimplementederror ', 'osserror', 'overflowerror', 'pendingdeprecationwarning ',
'Permissionerror', 'processlookuperror ', 'referenceerror', 'resourcewarning', 'runtimeerror', 'runtimewarning', 'stopiteration ',
'Syntaxerror', 'syntaxwarning', 'systemerror', 'systemdelete', 'taberror', 'timeoutererror', 'true', 'typeerror', 'unboundlocalerror ',
'Unicodedecodeerror', 'unicodeencodeerror', 'unicodeerror', 'unicodetranslateerror', 'unicodewarning', 'userwarning ',
'Valueerror', 'warning', 'windowserror ', 'zerodivisionerror',' _ ',' _ build_class _ ',' _ debug __', '_ doc _', '_ import _', '_ loader __',
'_ Name _', '_ package _', '_ spec _', 'abs ', 'all', 'any', 'ascii ', 'bin', 'bool ', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile ',
'Compute', 'copyright', 'credits ', 'delattr', 'dict', 'dir', 'didmod ', 'enumerate', 'eval', 'exec ', 'Exit ', 'filter', 'float', 'format', 'frozenset ',
'Getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'isinstance ', 'issubclass ', 'iter', 'len', 'license ', 'LIST', 'locals', 'map ',
'Max', 'memoryview', 'Min', 'Next', 'object', 'oct', 'open', 'ord ', 'pow', 'print ', 'properties', 'quit', 'range', 'repr', 'reversed ', 'round', 'set ',
'Setattr', 'slice ', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars ', 'zip']
To view what a BIF is doing, type help (method name) in the shell, for example, help (isinstance), and you will get the function description of this BIF:
>>> Help (isinstance)
Help on built-in function isinstance in module builtins:
Isinstance (...)
Isinstance (object, class-or-type-or-tuple)-> bool
Return whether an object is an instance of a class or of a subclass thereof.
With a type as second argument, return whether that is the object's type.
The form using a tuple, isinstance (x, (A, B,...), is a temporary cut
Isinstance (x, A) or isinstance (x, B) or... (etc .).
You can get the introduction and usage of the isinstance function.