User: dan@sartography.com clicked save for examples/1-basic-concepts/understanding-data-part-1/python.bpmn

This commit is contained in:
sartography-automated-committer 2024-02-14 14:35:51 +00:00
parent 07367447cd
commit bf4122c474
1 changed files with 26 additions and 10 deletions

View File

@ -49,8 +49,8 @@ cabinet = {
<bpmn:manualTask id="Activity_0n8y9m7" name="About PEP8">
<bpmn:extensionElements>
<spiffworkflow:instructionsForEndUser># Readability
The creator of Python Guido van Rossum, said
“Code is read much more often than its written.” IT's important to create code that is easy to understand later on.
The creator of Python, Guido van Rossum, said
“Code is read much more often than its written.” It is worth taking the time to create code that is easy to understand.
For this reason we recommend following a popular standard called [PEP8](https://realpython.com/python-pep8/)
@ -63,22 +63,31 @@ being consistent in the naming of your variables makes them far easier to rememb
* my_name (GOOD)
* MyName (NO)
* myname (NO)
* myname (NO)
### Use Thoughtful names.
Avoid names that don't have meaning, or are cryptic. Try to names that are descriptive and concise.
* first_name = "Alex" (GOOD)
* x = "Abraham Lincoln" (NO)
* fn = "Abraham" (NO)
Avoid names that don't have meaning, or are cryptic. Try to use names that are descriptive and concise.
* first_name = "Abraham" (GOOD)
* x = "Abraham Lincoln" (AVOID)
* fn = "Abraham" (AVOID)
### Use blank lines, sparingly, to show clear steps
### Whitespace
* Use blank lines, sparingly, to show clear steps
A little white space can make your code more readable.
So can comments.
* "Sparse is better than dense" -- Zen of Python. Place spaces around operators and boolean operations most of the time. Though it can be good to break this rule when there are multiple expressions of different priority. Take the following example, where the second line is harder to read than the first.
### Use Comments
A few carefully chosen words can help *IF it isn't apparent already.* Good variable names and well written code come first.
```python
if x &lt; 5: # GOOD
if x&gt;5 and x&lt;10 : # GOOD
if x &gt; 5 and x &lt; 10: # NOT AS GOOD
```
### Use Comments Sparingly
A few carefully chosen words can help *IF it isn't apparent already.* Good variable names and well written code come first. Then add additional comments only if the information is not already apparent in the code.
### Closing Brackets and braces
We work with dictionaries a lot. So we recommend closing your braces and brackets with the first line to make it easy to tell when the dictionary definition is complete. For example:
@ -92,6 +101,13 @@ children = {
"Willie"
}
```
# “Simple is better than complex.”
* Don't compare booleans, it's not necessary
</spiffworkflow:instructionsForEndUser>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0ggy7w4</bpmn:incoming>