If the convention in Python is to capitalize classes, why then is list() not capitalized? Is it not a class?

前端 未结 5 1499
耶瑟儿~
耶瑟儿~ 2020-12-08 15:17

Often when I see class definitions class Foo:, I always see them start with upper case letters.

However, isn\'t a list [] or a dict {

5条回答
  •  无人及你
    2020-12-08 15:49

    PEP8 is the place to go for code style.

    To address your question on why list = list() is valid, list is simply a name in the global namespace, and can be overriden like any other variable.

提交回复
热议问题