문제

I write code with Python using Django framework. Now I have read about all these coding style advices, but encountered a vague thing.

In djangoproject section here https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#python-style it says that function comments should say like:

Does that, returns that.

However, here http://www.python.org/dev/peps/pep-0257/#one-line-docstrings it says that it should say like:

Do that, return that.

So, which option is true?

도움이 되었습니까?

해결책

PEP 8 follows the first person singular. Django documentation standard follows the third person singular. The former one is standard.

다른 팁

There is no true code style rule. Every framework, library and software can redefine some style rule for its own project.

In my personal code I prefer to use the more general code style rule (in this case the official Python one) but you should specify this in your documentation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top