Why does Pycharm’s inspector complain about “d = {}”?

What is the code following your dictionary declaration?

I think PyCharm will trigger the error if you have something like:

dic = {}
dic['aaa'] = 5

as you could have written

dic = {'aaa': 5}

Note: The fact that the error goes away if you use the function dict(). This doesn’t necessarily mean that pycharm believes dict() is a literal. It could just mean that it doesn’t complain about it:

dic = dict()
dic['aaa'] = 5

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)