Ivan Mishalkin
Ivan Mishalkin

Reputation: 1108

Is it possible to know before execution if the variable would be changed with ast Python?

I have a string with python code inside, for example:

df.head()

and

df.dropna(inplace=True)

Is it possible, using ast to know whether the execution will change initial variable(second case) or not(first case)

Upvotes: 1

Views: 32

Answers (1)

vidstige
vidstige

Reputation: 13085

No, this is not possible in the general case as outlined in the Halting Problem. This goes for all languages, not just python.

Upvotes: 4

Related Questions