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:44:47 +00:00
parent bf4122c474
commit 186e271236
1 changed files with 16 additions and 5 deletions

View File

@ -54,7 +54,7 @@ The creator of Python, Guido van Rossum, said
For this reason we recommend following a popular standard called [PEP8](https://realpython.com/python-pep8/)
Here are some highlights from the standard, along with a few additions specific to working with SpiffWorkflow:
Here are some highlights from the standard...
## Variables
@ -71,7 +71,7 @@ Avoid names that don't have meaning, or are cryptic. Try to use names that are
* x = "Abraham Lincoln" (AVOID)
* fn = "Abraham" (AVOID)
### Whitespace
## Whitespace
* Use blank lines, sparingly, to show clear steps
A little white space can make your code more readable.
So can comments.
@ -86,10 +86,10 @@ if x > 5 and x < 10: # NOT AS GOOD
```
### Use Comments Sparingly
## 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
## 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:
@ -102,10 +102,21 @@ children = {
}
```
# “Simple is better than complex.”
* Don't compare booleans, it's not necessary
```python
is_bigger = 6 > 5
if is_bigger: # GOOD
if is_bigger == True: # AVOID
```
* "is not" is easier to read:
```python
if not x is None: # AVOID
if x is not None: # GOOD
```
</spiffworkflow:instructionsForEndUser>