5 ms·
In Python there is a convention for naming classes with `CamelCase` and instances with `snake_case`. It works very well, you can always tell if you are dealing
by scardine 11y ago
In Python there is a convention for naming classes with `CamelCase` and instances with `snake_case`. It works very well, you can always tell if you are dealing with a class or an instance.
Personally I believe code is harder to read than to write, so I favor languages that are easier to read.
- lmm 11y agoIf such a convention applied consistently that would be great. But my Python experience is that it isn't, and an inconsistent convention is worse than useless. If such a distinction is to be meaningful then IMO the language itself needs to enforce it.
- scardine 11y agoI agree, it should be mandatory - one of the things I like about Nim is static typing. Oddly enough, the "we are all consenting adults" attitude works in Python. Most patterns and interfaces are by convention instead of being enforced. People don't abuse Pythons permissive nature very often, and when they do they are frowned upon by the community. I think such deviations are easier to spot in Python compared to other languages, don't really know why.
- piva00 11y agoExactly why I like Go's conventions for public/private, when I was younger and less experienced I always thought that it was great to have freedom to name things however I wanted but now I can't find a good argument against opinionated and enforced conventions for naming. I actually would appreciate if someone could provide me one.
- federico3 11y agoKeep in mind that Nim is statically typed and the typing prevents ambiguity: foo.say_hi() and SayHi() are not the same.