mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
Cosmetic changes
This commit is contained in:
parent
e433c974bc
commit
adc940eabf
1 changed files with 15 additions and 12 deletions
27
Lib/types.py
27
Lib/types.py
|
@ -16,22 +16,25 @@ TupleType = type(())
|
||||||
ListType = type([])
|
ListType = type([])
|
||||||
DictionaryType = type({})
|
DictionaryType = type({})
|
||||||
|
|
||||||
def func(): pass
|
def _f(): pass
|
||||||
FunctionType = type(func)
|
FunctionType = type(_f)
|
||||||
|
LambdaType = type(lambda: None) # Same as FunctionType
|
||||||
|
CodeType = type(_f.func_code)
|
||||||
|
|
||||||
class C:
|
class _C:
|
||||||
def meth(self): pass
|
def _m(self): pass
|
||||||
ClassType = type(C)
|
ClassType = type(_C)
|
||||||
UnboundMethodType = type(C.meth) # Same as MethodType
|
UnboundMethodType = type(_C._m) # Same as MethodType
|
||||||
x = C()
|
_x = _C()
|
||||||
InstanceType = type(x)
|
InstanceType = type(_x)
|
||||||
MethodType = type(x.meth)
|
MethodType = type(_x._m)
|
||||||
|
|
||||||
BuiltinFunctionType = type(len) # Also used for built-in methods
|
BuiltinFunctionType = type(len)
|
||||||
|
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
|
||||||
|
|
||||||
ModuleType = type(sys)
|
ModuleType = type(sys)
|
||||||
|
|
||||||
FileType = type(sys.stdin)
|
FileType = type(sys.stdin) # XXX what if it was assigned to?
|
||||||
XRangeType = type(xrange(0))
|
XRangeType = type(xrange(0))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -40,4 +43,4 @@ except TypeError:
|
||||||
TracebackType = type(sys.exc_traceback)
|
TracebackType = type(sys.exc_traceback)
|
||||||
FrameType = type(sys.exc_traceback.tb_frame)
|
FrameType = type(sys.exc_traceback.tb_frame)
|
||||||
|
|
||||||
del sys, func, C, x # These are not for export
|
del sys, _f, _C, _x # Not for export
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue