Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code readability with PEP8 Style Guide for Python Code #24

Open
txenoo opened this issue Mar 1, 2016 · 2 comments
Open

Improve code readability with PEP8 Style Guide for Python Code #24

txenoo opened this issue Mar 1, 2016 · 2 comments

Comments

@txenoo
Copy link
Contributor

txenoo commented Mar 1, 2016

https://www.python.org/dev/peps/pep-0008/

@iago1460
Copy link
Owner

iago1460 commented Mar 6, 2016

I do not agree entirely with pep8 rules, the max line length for this project is 120 and the way to split big function calls like:

value = function_name(
    arg1, arg2
)

The commit 6d92bca should fix the majority of this issues

@stefan-walluhn
Copy link

I merged your changes you committed in 6d92bca. There are still some changes remaining in my pull request. I commented all my changes at
https://github.com/iago1460/django-radio/pull/23/files

I did not touch the migration 0001_initial.py again, since there were no changes in 6d92bca. Let me know, if there is something left for the migration.

Some additions regarding pep8 rules: While pep8 helps a lot to gain readability the meaning of it is not to just follow the rules impassively, but to use pep8 to outline the meaning of a particular part of code. So my goal to apply pep8 rules was not to just match some kind of definition, but to understand your code by improving code readability while following pep8.

For example, pep8 allows multiple ways to split function calls. If there are function params containing function calls themselves, it is much more readable to split them one by line. For example, it is much more readable to write:

def foo(
    bar=1,
    baz=x(a, b, c),
    buz=y(d, e, f))

than to have something like this:

def foo(
    bar=1, baz=x(a, b, c),
    buz=y(d, e, f))

or even something like this.

def foo(
    bar=1, baz=x(
        a, b, c
    ), buz=y(d, e, f))

since it is harder to recognize that there are 3 params for foo() in the last ways of coding style (while all versions are valid according pep8).

Nevertheless, it would be very helpful to reach a clean code base for me again by getting my pull request accepted, since there are some development branches in my repo for several new features and it is hard work to solve all merges and conflicts that are caused by a split brain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants