Am I immoral for using a variable name that differs from its type only by case?

前端 未结 8 1022
醉梦人生
醉梦人生 2021-02-11 11:43

For instance, take this piece of code:

var person = new Person();

or for you Pythonistas:

person = Person()

I

8条回答
  •  死守一世寂寞
    2021-02-11 12:29

    I don't think it's necessarily "bad", but obviously if you can qualify it to give it more context, like what sort of person it is (you are dealing with only one of presumably many possible persons), then someone else picking it up may understand better.

提交回复
热议问题