Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5617a43

Browse files
committed
Use isinstance for type checking
1 parentd10e335 commit5617a43

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎bpython/simpleeval.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ def _convert(node):
139139
left=_convert(node.left)
140140
right=_convert(node.right)
141141
ifnot (
142-
type(left)in_numeric_typesandtype(right)in_numeric_types
142+
isinstance(left,_numeric_types)
143+
andisinstance(right,_numeric_types)
143144
):
144145
raiseValueError("binary + and - only allowed on builtin nums")
145146
ifisinstance(node.op,ast.Add):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp