everstarter everstarter - 14 days ago 9
Python Question

python IDE, code suggestion, pycharm

I use latest community pycharm(2016.2.3) under windows 7 with latest python 2.7.

I write a little in python but it gives me big pain with code completion.

For example:

I want to use beautiful soup library.
I installed it with pip in pycharm.
I do import:

from bs4 import BeautifulSoup, Tag


(I found about Tag here, on stackoverflow, it helps to receive more suggestions)
...
I wrote some code..

response = urllib2.urlopen('some link')
html = response.read()
soup = BeautifulSoup(html,'html.parser')
texto = soup.find(id="Phone")


Working code written by hand:

UNC=texto.find(text="Line Key 2").findNext('tr').findNext('tr').findNext('tr').find_all('input')[0]['name']


Now I try to receive suggestion:
text2=texto.
<- here I press Ctrl+Space

What I receive:
enter image description here

Let's try other suggestion test:

text2=soup.
<- here I press Ctrl+Space

Ok. Here is what I receive:

enter image description here

There is find method, okay. Let's try this:

text2=soup.find(id='user').
<- here I press Ctrl+Space

And I do not see any methods I need! Why there is no find() or findNext() in suggestion (see hand written code)?
But many other items. Why??

I really like python, but code suggestion makes me cry.

Is it possible to have code suggestion like in MS Visual Studion with C#?

Answer

OK. I finally realized that because of dynamical typization suggestions some time could not be dynamically evaluated. So have to read documentation and code.