1

Is there an existing naming convention for using abbreviations in Django classes (e.g. models, forms, etc)? Specifically I'm interested if there's different rules between abbreviations/acronyms/initialisms?

So far I've only found examples of non-acronyms:

  • XMLField
  • HTTPRequest

What should a JSON field be called (since it's an acronym)?

  • JSONField, or
  • JsonField
4

1 回答 1

5

PEP 8开始:

使用JSONFieldJsonField

由于 CapWords 用于类名,因此此注释适用:

注意:在 CapWords 中使用缩写词时,将缩写词的所有字母大写。因此 HTTPServerError 比 HttpServerError 好。

于 2012-10-28T23:35:24.480 回答