温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

python3的bif数量

发布时间:2020-08-24 10:08:53 阅读:191 作者:Leah 栏目:编程语言
Python开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

这篇文章将为大家详细讲解有关python3的bif数量,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

BIF(built-in functions)顾名思义,就是Erlang内建函数。它们通常用来完成那此无法用Erlang完成的任务。比如将列表转换为元组或者获取当前的时间和日期。完成这些操作的函数,我们称之为BIF。python中提供了大量的内置功能函数,这就意味着你可以少些很多的代码。Python3中共提供了72个BIF。

我们可以在python或IDLE shell中,输入dir(__builtins__)级可看到python的内置方法列表,"builtins"的前后都是两个下划线,shell会给出一个庞大的列表,如下:

['ArithmeticError''AssertionError''AttributeError''BaseException''BlockingIOError''BrokenPipeError''BufferError''BytesWarning''ChildProcessError''ConnectionAbortedError''ConnectionError''ConnectionRefusedError''ConnectionResetError''DeprecationWarning''EOFError''Ellipsis''EnvironmentError''Exception''False''FileExistsError''FileNotFoundError''FloatingPointError''FutureWarning''GeneratorExit''IOError''ImportError''ImportWarning''IndentationError''IndexError''InterruptedError''IsADirectoryError''KeyError''KeyboardInterrupt''LookupError''MemoryError''NameError''None''NotADirectoryError''NotImplemented''NotImplementedError''OSError''OverflowError''PendingDeprecationWarning''PermissionError''ProcessLookupError''ReferenceError''ResourceWarning''RuntimeError''RuntimeWarning''StopIteration',
'SyntaxError''SyntaxWarning''SystemError''SystemExit''TabError''TimeoutError''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',
'complex''copyright''credits''delattr''dict''dir''divmod''enumerate''eval''exec''exit''filter''float''format''frozenset''getattr''globals''hasattr''hash''help''hex''id''input''int''isinstance''issubclass''iter''len''license''list''locals''map''max''memoryview''min''next''object''oct''open''ord''pow''print''property''quit''range''repr''reversed''round''set''setattr''slice''sorted''staticmethod''str''sum''super''tuple''type''vars''zip']

要查看某个BIF是干什么的,可以在shell中键入help(方法名),如:help(isinstance)就会得到这个BIF的功能描述。如下:

>>> help(isinstance)
Help on built-in function isinstance in module builtins:
isinstance(...)
    isinstance(objectclass-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 shortcut for
    isinstance(x, A) or isinstance(x, B) or ... (etc.).

就可以得到isinstance函数的介绍和使用方法。

关于python3的bif数量就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×