Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse a boolean expression with "~E" #19439

Closed
lwerdna opened this issue May 27, 2020 · 1 comment
Closed

Unable to parse a boolean expression with "~E" #19439

lwerdna opened this issue May 27, 2020 · 1 comment

Comments

@lwerdna
Copy link

lwerdna commented May 27, 2020

There's something about "not E" or "~E" that the parser doesn't like. Notice other letters and "E" alone are fine:

>>> import sympy
>>> sympy.parsing.sympy_parser.parse_expr('A')
A
>>> sympy.parsing.sympy_parser.parse_expr('E')
E
>>> sympy.parsing.sympy_parser.parse_expr('~E')
Traceback (most recent call last):
...
TypeError: bad operand type for unary ~: 'Exp1'
@lwerdna lwerdna changed the title Unable to parse a boolean expression with a variable named 'E' Unable to parse a boolean expression with "~E" May 27, 2020
@lwerdna
Copy link
Author

lwerdna commented May 27, 2020

I found that parsing "I" raises TypeError: bad operand type for unary ~: 'ImaginaryUnit' so then I looked into the local_dict and global_dict keyword arguments. I thought that since they were by default None, it meant no variable lookup during parsing. I didn't realize it means it won't override the default variables. My mistake, sorry if this was any inconvenience.

@lwerdna lwerdna closed this as completed May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant