Adding # type: to variables split across multiple lines doesn't work

Answered

I have a class I use as a connector to Microsoft SQL Servers, the connection line looks like:

self.connection = pyodbc.connect('', driver='{SQL Server}', server=hostname, uid=username, pwd=password, port=port, autocommit=autocommit)  # type: pyodbc.Connection

That is a tad long so you might think to split it at port=

self.connection = pyodbc.connect('', driver='{SQL Server}', server=hostname, uid=username, pwd=password, 
port=port, autocommit=autocommit) # type: pyodbc.Connection

However only the first example (all on one line) works when you do self.connection. and want to see all available methods and parameters.

2 comments
Comment actions Permalink

Hi there. Sorry for such an awfully late reply.

 

It should have been fixed back in PyCharm 2016.2.1 as part of PY-19220.

0
Comment actions Permalink

I completely forgot I even had this open or that it was even an issue. I use this all the time so I know it is fixed and working now.

0

Please sign in to leave a comment.