Can PyCharm suggest use of list comprehension in Intentions?
Hi,
I'm just starting with PyCharm and coming from a Visual Studio / ReSharper background, I'm used to ReSharper making lots of useful code improvement suggestions.
I was hoping PyCharm would do the same - e.g. to suggest use of list comprehension when it detects it could be used.
My install is NOT doing this - do I need to configure anything?
I've looked under Intentions, but can't see anything obvious.
Please sign in to leave a comment.
PyCharm should obviously do that, code completion/suggestions is one of the main features.
Do you have interpreter selected? Can you run your code? Please provide description of your setup, screenshots and examples to demonstrate the issue.
Hi Andrew, thanks for responding.
> PyCharm should obviously do that, code completion/suggestions is one of the main features.
Agreed, the main reason I was looking forward to using PyCharm was to learn better Python from its suggestions.
> Do you have interpreter selected?
Well, I _think_ I do - we're using v2.7 on our project. Does this look right?
> Can you run your code
Yes, I've reproduced a simple example of the code below. If I understand correctly, PyCharm should suggest that I can convert the first 3 lines in `create_array` using list comprehension?
```
```
Ok, thanks for the example. Intentions can convert list comprehension to a for loot, but not vice versa, unfortunately. The closest thing we have is list comprehension live template, e.g. try typing `compl` after `values = []` and press enter on list comprehension template.
But that's not what you want, sorry.
Almost forgot - Please feel free to submit a corresponding feature request to our issue tracker using the link https://youtrack.jetbrains.com/issues and let us know if you need any help.
Thanks for your feedback, Andrey.
As suggested, I've added a YouTrack for this issue - https://youtrack.jetbrains.com/issue/PY-38259