MCPcopy
hub / github.com/cool-RR/PySnooper / needs_parentheses

Function needs_parentheses

pysnooper/variables.py:13–17  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

11
12
13def needs_parentheses(source):
14 def code(s):
15 return compile(s, '<variable>', 'eval').co_code
16
17 return code('{}.x'.format(source)) != code('({}).x'.format(source))
18
19
20class BaseVariable(pycompat.ABC):

Callers 2

test_needs_parenthesesFunction · 0.90
__init__Method · 0.85

Calls 1

codeFunction · 0.85

Tested by 1

test_needs_parenthesesFunction · 0.72