Ryan Ollos
10 years ago
Over the past several months I've accumulated in my notes a few items that
I would like to add to the coding guidelines (1). I'm seeking feedback on
these changes before editing the wiki.
- Use trailing underscore to avoid conflicts with built-in keywords. I've
seen this practice sparingly in the codebase and it's actually suggested in
PEP-0008, but we have many instances of variables such as "id", so I think
it would be good to add this point to the CodingStyle document.
- On the trunk (Python 2.6+) we can start using str.format() rather than
the string interpolation operator. Should str.format() be preferred?
- The brackets are unnecessary in Genshi template variable. My suggestions
is that $var be preferred to ${var}
- Generally I seem to prefer putting the properties / attributes before
methods in class definitions, but I tend to think that's something I
picked-up from C++ and maybe shouldn't be a guideline.
I'll add more item here for comment when I think of them. Thanks for any
feedback.
(1) http://trac.edgewall.org/wiki/TracDev/CodingStyle
(2) https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles
I would like to add to the coding guidelines (1). I'm seeking feedback on
these changes before editing the wiki.
- Use trailing underscore to avoid conflicts with built-in keywords. I've
seen this practice sparingly in the codebase and it's actually suggested in
PEP-0008, but we have many instances of variables such as "id", so I think
it would be good to add this point to the CodingStyle document.
- On the trunk (Python 2.6+) we can start using str.format() rather than
the string interpolation operator. Should str.format() be preferred?
- The brackets are unnecessary in Genshi template variable. My suggestions
is that $var be preferred to ${var}
- Generally I seem to prefer putting the properties / attributes before
methods in class definitions, but I tend to think that's something I
picked-up from C++ and maybe shouldn't be a guideline.
I'll add more item here for comment when I think of them. Thanks for any
feedback.
(1) http://trac.edgewall.org/wiki/TracDev/CodingStyle
(2) https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles
--
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Trac Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-dev+***@googlegroups.com.
To post to this group, send email to trac-***@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.