Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: pages/coding-style.html

Issue 29342128: Noissue - Add requirement for Python 3.5 compatibility to Python section of the coding style guide (Closed)
Patch Set: Created May 17, 2016, 5:28 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pages/coding-style.html
===================================================================
--- a/pages/coding-style.html
+++ b/pages/coding-style.html
@@ -39,16 +39,17 @@
<li>{{html-css-order CSS rule declaration order should follow the <a href="https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#property-ordering">WordPress CSS Coding Standards</a>.}}</li>
<li>{{html-css-units CSS number values should specify units where possible.}}</li>
<li>{{html-css-leading-zero Don't omit the optional leading 0 for decimal numbers.}}</li>
</ul>
<h2 id="python">{{s19 Python}}</h2>
<ul>
<li>{{python-general Follow <a href="https://www.python.org/dev/peps/pep-0008/">PEP-8</a> and the recommendations in the offical Python documentation.}}</li>
+ <li>Make the code compatible with both Python 2.7 and Python 3.5 (see <a href="https://docs.python.org/dev/howto/pyporting.html">this guide</a>). Use <a href="https://docs.python.org/2/library/__future__.html">__future__ imports</a> to address syntactic differences but avoid <a href="https://pythonhosted.org/six/">six</a>, <a href="http://python-future.org/compatible_idioms.html">python-future</a>, etc. to not introduce additional dependencies.</li>
Sebastian Noack 2016/05/17 17:51:00 You forgot to use the boilerplate to make this str
Sebastian Noack 2016/05/17 17:51:00 Perhaps we shouldn't even make Python 2.7 mandator
Vasily Kuznetsov 2016/05/18 08:50:50 Oops, that's embarrassing. Fixed.
Vasily Kuznetsov 2016/05/18 08:50:50 While I support the intention of dropping Python 2
Wladimir Palant 2016/05/18 18:28:09 So what we are talking about is merely the transit
Wladimir Palant 2016/05/18 18:47:47 Matze says that there is a plan to upgrade the ser
Sebastian Noack 2016/05/18 19:06:32 Whichever Python version is available on the serve
Vasily Kuznetsov 2016/05/19 09:03:31 So we all agree that we would like to eventually m
Sebastian Noack 2016/05/19 10:10:24 Yes, Python 3.6+ will in theory be backwards compa
Vasily Kuznetsov 2016/05/19 10:52:28 Done.
Wladimir Palant 2016/05/19 11:33:26 As long as this is about automated testing - yes,
Sebastian Noack 2016/05/19 11:51:53 I agree, that when manually testing it's important
<li>{{python-strings Write string literals so that they match the behaviour of <a href="https://docs.python.org/2/library/functions.html#func-repr"><code><fix>repr()</fix></code></a> in Python 2, or <a href="https://docs.python.org/3/library/functions.html#ascii"><code><fix>ascii()</fix></code></a> in Python 3, i.e. use single quotes except to avoid escaping of embedded quotes and escape special and non-ascii characters. For docstrings, however, follow <a href="https://www.python.org/dev/peps/pep-0257/">PEP-257</a>.}}</li>
<li>{{python-prefix In modules, prefix private functions and variables with a single underscore.}}</li>
<li>{{python-concatenation Use the <code><fix>+</fix></code> operator when concatenating exactly two strings, use the <a href="https://docs.python.org/2/library/stdtypes.html#str.format"><code><fix>format()</fix></code> method</a> for more complex string formatting, use the <a href="https://docs.python.org/2/library/stdtypes.html#str.join"><code><fix>join()</fix></code> method</a> when concatenating pre-existing sequences.}}</li>
<li>{{python-tuple-vs-list Use tuples for data that have structure, use lists for data that have order.}}</li>
<li>{{python-builtins Don't override builtins except for <a href="https://docs.python.org/2/library/functions.html#non-essential-built-in-funcs">non-essential builtins</a> and <code><fix>file</fix></code> which is superfluos in modern code as well.}}</li>
<li>{{python-map-filter Use list comprehensions or generator expressions instead of calling <code><fix>map()</fix></code> or <code><fix>filter()</fix></code> with a lambda function.}}</li>
<li>{{python-regexp Use <a href="https://docs.python.org/2/library/re.html#re.search"><code><fix>re.search()</fix></code></a> instead of <code><fix>re.match()</fix></code> to avoid <a href="https://docs.python.org/2/library/re.html#search-vs-match">confusion</a> about implied beginning of the string but not the ending.}}</li>
<li>{{python-flake8 Run <a href="https://pypi.python.org/pypi/flake8">flake8</a> with the <a href="https://hg.adblockplus.org/codingtools/file/tip/flake8-abp">flake8-abp</a> and <a href="https://pypi.python.org/pypi/pep8-naming">pep8-naming</a> extensions and fix any warning.}}</li>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld