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

前端 未结 5 1498
耶瑟儿~
耶瑟儿~ 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 16:00

    According to PEP 8, a nice set of guidelines for Python developers:

    Almost without exception, class names use the CapWords convention. Classes for internal use have a leading underscore in addition.

    PEP 8 is directed at Python development for the standard library in the main Python distribution, but they're sensible guidelines to follow.

提交回复
热议问题