Oct-20-2018, 11:26 AM
(Oct-20-2018, 11:07 AM)snippsat Wrote:(Oct-20-2018, 09:39 AM)volcano63 Wrote: Aren't you tired of the herds of camelCase in the demonstrated code?Sure,but can not do anything else than mention that camelCase is not okay style in Python.
Noone usually bothers to.
(Oct-20-2018, 11:07 AM)snippsat Wrote:(Oct-20-2018, 09:39 AM)volcano63 Wrote: Shouting out bad code practicesNo need to shout it out,can mention PEP-8,an give example with better code style.
A site pep8.org with better CSS layout for PEP-8.
"Bad programming practice" is not necessarilly PEP-8 - some glaring examples
- Redundant (and ugly) boolean tests
cond == True
andcond is True
- Comprehensions to call functions in a loop
[print(obj) for obj in objects]
- Redundant
else
s andcontinue
s (I lovedcontinue
in the last conditional expression in the loop )
Considering that advice to abandon Python 2 is given freely, I find it strange that noone bothers to help educate newbies in Python
do not
s. Sometimes not for the sake of the poster (who may be quite a PITA about accepting constructive criticism), but for the sake of another newbies who do not know better.
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.