Форум сайта python.su
19
isdigit?
Отредактировано PanovSergey (Фев. 13, 2014 11:37:30)
Офлайн
22
Офлайн
857
dimy44с равно, похоже, устаревший вариант
Ну не по-питоняч'е это. Типа как if x == None вместо if x is None
[guest@localhost main]$ grep -r 'if type(.*) ==' /usr/lib64/python3.3/
/usr/lib64/python3.3/xmlrpc/client.py: if type(item) == type({}):
/usr/lib64/python3.3/xmlrpc/client.py: elif type(item) == type([]):
/usr/lib64/python3.3/curses/ascii.py: if type(c) == type(""):
/usr/lib64/python3.3/curses/ascii.py: if type(c) == type(""):
/usr/lib64/python3.3/curses/ascii.py: if type(c) == type(""):
/usr/lib64/python3.3/curses/ascii.py: if type(c) == type(""):
/usr/lib64/python3.3/csv.py: if type(colType) == type(0): # it's a length
/usr/lib64/python3.3/multiprocessing/connection.py: if type(address) == tuple:
/usr/lib64/python3.3/turtle.py: if type(value) == types.FunctionType:
/usr/lib64/python3.3/lib2to3/pytree.py: if type(val) == int: _type_reprs[val] = name
/usr/lib64/python3.3/lib2to3/btm_matcher.py: if type(val) == int: _type_reprs[val] = name
/usr/lib64/python3.3/sunau.py: if type(f) == type(''):
/usr/lib64/python3.3/sunau.py: if type(f) == type(''):
/usr/lib64/python3.3/collections/__init__.py: if type(initlist) == type(self.data):
/usr/lib64/python3.3/fractions.py: if type(self) == Fraction:
/usr/lib64/python3.3/fractions.py: if type(self) == Fraction:
/usr/lib64/python3.3/getopt.py: if type(longopts) == type(""):
/usr/lib64/python3.3/pty.py: if type(argv) == type(''):
[guest@localhost main]$
[guest@localhost main]$ grep -r 'if type(.*) is' /usr/lib64/python3.3/
/usr/lib64/python3.3/pickle.py: if type(k) is str:
/usr/lib64/python3.3/pydoc.py: if type(entry) is type(()):
/usr/lib64/python3.3/pydoc.py: elif type(entry) is type([]):
/usr/lib64/python3.3/pydoc.py: if type(entry) is type(()):
/usr/lib64/python3.3/pydoc.py: elif type(entry) is type([]):
/usr/lib64/python3.3/pydoc.py: if type(request) is type(''):
/usr/lib64/python3.3/pydoc.py: if type(target) is type(''):
/usr/lib64/python3.3/unittest/case.py: if type(self) is not type(other):
/usr/lib64/python3.3/unittest/case.py: if type(first) is type(second):
/usr/lib64/python3.3/unittest/mock.py: if type(target) is str:
/usr/lib64/python3.3/site-packages/cffi/backend_ctypes.py: elif type(self) is type(other):
/usr/lib64/python3.3/site-packages/lxml/html/soupparser.py: elif type(child) is NavigableString:
/usr/lib64/python3.3/site-packages/lxml/html/diff.py: if type(last) is not token or type(tok) is not token:
/usr/lib64/python3.3/distutils/command/upload.py: if type(value) is tuple:
/usr/lib64/python3.3/idlelib/MultiCall.py: if type(sequence) is str and len(sequence) > 2 and \
/usr/lib64/python3.3/idlelib/MultiCall.py: if type(sequence) is str and len(sequence) > 2 and \
/usr/lib64/python3.3/idlelib/ClassBrowser.py: if type(sup) is type(''):
/usr/lib64/python3.3/cgitb.py: if type(builtins) is type({}):
/usr/lib64/python3.3/multiprocessing/process.py: if type(status) is int:
/usr/lib64/python3.3/multiprocessing/connection.py: elif type(address) is str and address.startswith('\\\\'):
/usr/lib64/python3.3/multiprocessing/connection.py: elif type(address) is str:
/usr/lib64/python3.3/symbol.py: if type(_value) is type(0):
/usr/lib64/python3.3/wsgiref/handlers.py: if type(value) is str:
/usr/lib64/python3.3/wsgiref/validate.py: if type(v) is not bytes:
/usr/lib64/python3.3/wsgiref/headers.py: if type(headers) is not list:
/usr/lib64/python3.3/wsgiref/headers.py: if type(value) is str:
/usr/lib64/python3.3/lib2to3/pgen2/token.py: if type(_value) is type(0):
/usr/lib64/python3.3/decimal.py: if type(self) is Decimal:
/usr/lib64/python3.3/decimal.py: if type(self) is Decimal:
/usr/lib64/python3.3/doctest.py: if type(self) is not type(other):
/usr/lib64/python3.3/doctest.py: if type(self) is not type(other):
/usr/lib64/python3.3/doctest.py: if type(self) is not type(other):
/usr/lib64/python3.3/random.py: if type(self.random) is BuiltinMethod or type(getrandbits) is Method:
/usr/lib64/python3.3/test/support.py: elif type(dv) is not str or k not in self._partial_matches:
/usr/lib64/python3.3/imaplib.py: if type(literal) is type(self._command):
/usr/lib64/python3.3/pipes.py: if type(cmd) is not type(''):
/usr/lib64/python3.3/pipes.py: if type(cmd) is not type(''):
[guest@localhost main]$
FishHookвот именно, а всегда ли оно нужно: вот в чём вопрос
2. Поддерживает наследование
>>> class MyInt(int): ... pass ... >>> isinstance(MyInt(1), int) True >>> MyInt(1) is int False >>>
Отредактировано py.user.next (Фев. 13, 2014 21:10:48)
Офлайн