Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

Standardize Python Indentation - Tabs or Spaces #7

Open
cmlccie opened this issue Dec 13, 2016 · 2 comments · May be fixed by #21
Open

Standardize Python Indentation - Tabs or Spaces #7

cmlccie opened this issue Dec 13, 2016 · 2 comments · May be fixed by #21

Comments

@cmlccie
Copy link
Contributor

cmlccie commented Dec 13, 2016

Several students are experiencing 'inconsistent indentation' errors when editing and then executing the sample files.

Current Formating: The sample files (today) are using tabs for indentation.

Problem: The default settings of the Notepad++ editor that many of them are using defaults to converting tabs-to-spaces. When they add new lines to the sample files, their editor is replacing their 'tabs' to spaces and causing the execution errors.

Recommendation: PEP 8 recommends using spaces as the 'leading practice', and recommends that "Tabs should be used solely to remain consistent with code that is already indented with tabs."

Either way (whether we go with tabs or spaces), I recommend that the sample-code files and the IDE settings (at least those in the dCloud environment) be set to use the same formatting. Additionally, with spaces being the 'leading practice', defaulting to this would likely provide greater 'compatibility' with IDEs on users' laptops.

@austinMarcos
Copy link
Contributor

In triage meeting today, decided that this requires further discussion to determine the standard that we want all authors to apply to code samples. Furthermore, will need to decide how we educate and enforce the standard. Our new curator, Diane, might be able to help monitor the usage of tab vs spaces.

@cmlccie
Copy link
Contributor Author

cmlccie commented May 11, 2017

That's great! I'm glad coding standards are being considered.

Rather than creating something from scratch, and to align with the industry, I would recommend that we simply adopt the industry leading practices (with modification only if it is justifiably necessary). For Python, this would mean adopting PEP8 and possibly either PEP257 or the Google style-guide for docstrings convention.

Another benefit of adopting these industry practices, is that monitoring for consistency also doesn't take too much work, as a code linter (like flake8 or the like) can be used to automate the testing of contributors code.

@cmlccie cmlccie linked a pull request May 18, 2017 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants