davidhalter / jedi

Awesome autocompletion, static analysis and refactoring library for python
http://jedi.readthedocs.io
Other
5.8k stars 508 forks source link

invalid syntax for star-unwrapped enumeration values #1680

Closed relikd closed 4 years ago

relikd commented 4 years ago

Hey there dear people,

not sure if this is the right place. I am using jedi with Anaconda in Sublime Text. I do get an “invalid syntax” error for legitimate python3 code:

x = [['RAM', 8, 8], ['CPU', 3.5]]
for kind, *values in x:
    print(f'{kind} has {len(values)} hardware components')

It is not a major issue but would be nice if my IDE would not complain about it 😄

relikd commented 4 years ago

Also, this is valid syntax but is not recognized as such:

def funny(title):
    return f'''
{title}
'''
davidhalter commented 4 years ago

jedi parso versions?

relikd commented 4 years ago

v0.17.1 I think https://github.com/DamnWidget/anaconda/commit/e8aeef9e591135af24cb56ed2d0a3a419dc38d00#diff-b9a7ec1566e6291ac30adb624c0aafe9a85eb5b92919299a551461840b883349R30

relikd commented 4 years ago

Nevermind, my bad. I changed the anaconda python interpreter to python3 and that fixed the issue.
But it seems everything is a bit mixed up:
Setting #!/usr/bin/env python3 seems to accept f-string but not the star-unwrap. Changing the interpreter will also accept the unwrap. weird. (but both ways the multiline f-string was working today, maybe a temporary hiccup?)

davidhalter commented 4 years ago

Not sure what it was, but in general Jedi only recognizes syntax for the Python version that you are using (in Jedi terms this is called an Environment).