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

SyntaxError when expression has "lambda" or λ #50

Closed
heyeshuang opened this issue Oct 14, 2021 · 4 comments
Closed

SyntaxError when expression has "lambda" or λ #50

heyeshuang opened this issue Oct 14, 2021 · 4 comments
Labels

Comments

@heyeshuang
Copy link

Hello, when I tried to run

py2tex("(V)*((lambda)**(-q))")

It threw a SyntaxError: invalid syntax.

I think it might because lambda is a reserved word of python.

@erwanp
Copy link
Owner

erwanp commented Oct 14, 2021

@emetor did you encounter this too ?

@emetor
Copy link
Collaborator

emetor commented Oct 14, 2021

Yes, I can confirm!
'lambda' is not a valid identifier in Python so you can use 'lbd' instead.

py2tex("(V)*((lbd)**(-q))")
$$V {\lambda}^{-q}$$

@emetor emetor closed this as completed Oct 14, 2021
@emetor emetor added the wontfix label Oct 14, 2021
@heyeshuang
Copy link
Author

Okay, then the unicode_tbl dict may also need to be changed. See

"λ": "lambda",

emetor added a commit that referenced this issue Oct 15, 2021
SyntaxError when expression has "lambda" or λ #50
@emetor
Copy link
Collaborator

emetor commented Oct 15, 2021

Thank you very much @heyeshuang for pointing this out. It is now fixed (also lambda).

"λ": "lbd",
"lambda": "lbd", # lambda is not a valid identifier in Python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants