elements-of-python-style icon indicating copy to clipboard operation
elements-of-python-style copied to clipboard

Goes beyond PEP8 to discuss what makes Python code feel great. A Strunk & White for Python.

Results 24 elements-of-python-style issues
Sort by recently updated
recently updated
newest added

@amontalenti , I hope this saves you some time... F-strings are [new in Python 3.6](https://docs.python.org/3/reference/lexical_analysis.html#f-strings) You may find them easier to compose and to read `f"result: {value:{width}.{precision}}"`. The tradeoffs are...

enhancement
will fix

I was listening to a Python coding standards talk today and there was a lot of discussion of `typing` in 3.x, `mypy`, and other related tools. This obviously introduces a...

enhancement
research needed
will fix

In a chat, @ngoldbaum mentioned: "I disagree that libraries should pin their requirements. A library wants to support as wide a range of dependency versions as is practical, so that...

enhancement
research needed
will fix

Link to the flake8 config docs is broken here: https://github.com/amontalenti/elements-of-python-style/blame/master/README.md#L36 Would have offered a PR, but there were a couple of pages that might have fulfilled the intent: * https://flake8.pycqa.org/en/latest/user/configuration.html...

bug
will fix

ReStructured Text is typically abbreviated as RST, not reST, so I've changed that here since reST is too much like REST. I've also added a parenthetical spelling out what RST...

research needed

The default Sphinx style for docstrings is hard to remember and not especially legible (unless rendered). Multiple friendlier alternatives exist, including the popular NumPy and Google formats, both of which...

research needed

The [section on string formatting](https://github.com/amontalenti/elements-of-python-style#strformat-vs-overloaded-format-) includes `str.format()` and string overloading (`%`). As of Python 3.6, [f-strings](https://www.python.org/dev/peps/pep-0498/) are also supported.

enhancement
will fix

See the Intermezzo here: https://docs.python.org/3/tutorial/controlflow.html#intermezzo-coding-style Which does a good job of summarizing PEP8 and benefits from existing in the official Python tutorial.

enhancement

Since Python3.5 supports for type hints. It could be better than writing docstring at sometimes. Such as follow example. We can learn from code a lot directly rather than docstring....

research needed