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

前端 未结 5 719
刺人心
刺人心 2020-12-23 12:53

When initializing a dictionary with d = {} Pycharm\'s code inspector generates a warning, saying

This dictionary creation could be rewrit

5条回答
  •  不思量自难忘°
    2020-12-23 13:30

    mydict = {
      a: 5,
      b:z+c/2
    }
    

    The dictionary could have been created directly without initialising them first and then reassigning new values.

提交回复
热议问题