4 ms·
Why they use Java like code in Python? "MessageToJson" doesn't look idiomatic.
by intricatedetail 6y ago
Why they use Java like code in Python? "MessageToJson" doesn't look idiomatic.
- singron 6y agoCapWords function names matches the C++ style guide at Google, not java. A lot of python uses autogenerated bindings to C++ code and reuses the same naming conventions. Even pure python code would use that style although their public styleguide doesn't mention it anymore.
- ipsum2 6y agoThe official protobuf library for Python is not pythonic at all.
- q3k 6y agoThis is because this follows Google’s internal Python styeguide, which was established well before PEP8 and even Python 2.x.
- joshuamorton 6y agoNotably this is no longer true[0]. While legacy stuff can still use the CapWords styling, snake_case names are preferred for all new methods and functions (including code that wraps c++). But this is a relatively recent change to the style guide, and the proto libraries far predate it. (As a response to a sibling of the parent, the same rules apply to internal code, CapWords should only be used for consistency within a file. All new code should be embrace it's snakey heritage). [0]: https://google.github.io/styleguide/pyguide.html#3162-naming-conventions https://google.github.io/styleguide/pyguide.html#3162-naming...