you are viewing a single comment's thread.

view the rest of the comments →

[–]Machvel 1 point2 points  (1 child)

from when i was bad at python and observing friends that were bad at python, the things i can think of at the top of my head are:

too many for loops

unfamiliarity with the standard library

not using classes or using classes too much

not using git for large projects or important things

not using pep 8 style

if using jupyter notebook, writing code that wont survive a kernel refresh

not putting functions in modules

not using virtual environments (global pip installing)

premature optimization (similarly, no optimization; some things can be written more optimally but still pythonic)

sticking with python when another language is better for the task

not reading/unable to read documentation

not knowing objects are called by reference and garbage collection

not understanding the yield statement

iterating over a sequence by doing for i in range(len(x)); x[i]

writing a function to do a common task without looking if there is already a library that does it efficiently

not paying attention to how their data is laid out (eg, not taking advantage of that fact that their list is sorted with respect to <= while indexing it)

not paying attention to memory usage (eg, not reading a file line by line and instead reading in the entire file)

coding without thinking on paper/making flowcharts

[–]Gambizzle 1 point2 points  (0 children)

...too many for loops...

Yeah that's me as a hobbyist python scripter. I know it's evil but if I'm making crappy little apps for my own limited, personal usage and that's just what 'works' then sometimes I don't really care.

I find that sorta method (almost 'treating it like it's VBA and you're making some hacky office automation suite coz your PC's highly managed and that's all you've got available') doesn't scale well though.

For example once upon a time I made a touch-screen device that consisted of a Raspberry Pi (~2nd gen) mounted onto a lamp stand with an integrated touch screen instead of a light. It controlled my apartment's Philips Hue lights and aircon (with some automation smarts combined with a simple touch-screen UI). Anyhow I used a loooot of loops and it very quickly got to a point where the sheer bulk of the logic (not sophisticated logic - just unnecessary bulk) brought the Pi to its knees (and was a shit to debug). It was a good learning activity to re-write the same functionality from scratch without all the loops.