当我阅读python源代码时,我发现了内置函数,如
class staticmethod(object):
"""
....
"""
def __getattribute__(self, name): # real signature unknown; restored from __doc__
""" x.__getattribute__('name') <==> x.name """
pass
def __get__(self, obj, type=None): # real signature unknown; restored from __doc__
""" descr.__get__(obj[, type]) -> value """
pass
def __init__(self, function): # real signature unknown; restored from __doc__
pass
@staticmethod # known case of __new__
def __new__(S, *more): # real signature unknown; restored from __doc__
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass
__func__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
我的问题是空方法是什么?为什么要写在这里?
答案 0 :(得分:0)
Python的一些(可能是大多数)内置函数是用C语言编写的,因此没有Python实现。