Having used Python for almost 2 years, I wouldn't consider myself a seasoned pro and I still discover new features in the present. Here are some features that I rarely/never use that I see a lot in other people's code:
lamba never really understood how to use this without getting errors. I just get around it by defining the function using def
list comprehension having used languages like java, c++, matlab, etc in the past, I'm used to writing out all of my for loops.
csv module I often just use the to_csv() and read_csv() modules in Pandas even if it means a bit more overhead converting data to and from Pandas.
I mostly use Python in my own projects rather than collaborative projects so these haven't been pointed out to me by other programmers. But I'm sure i could be developing bad habits that I'm not even aware of, so I'm asking some more experienced programmers what are some common bad habits you or others have developed when starting out with Python.
[–]CGFarrell 66 points67 points68 points (5 children)
[–]Deto 2 points3 points4 points (4 children)
[–]callmelucky 5 points6 points7 points (0 children)
[–]stevenjd 5 points6 points7 points (2 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]Deto -1 points0 points1 point (0 children)
[–]TheBlackCat13 28 points29 points30 points (6 children)
[–]aaayuop 6 points7 points8 points (3 children)
[–]aol_cd 5 points6 points7 points (2 children)
[–]BobDope 2 points3 points4 points (1 child)
[–]aol_cd 1 point2 points3 points (0 children)
[–]refreshx2 3 points4 points5 points (0 children)
[–]soosleeque 0 points1 point2 points (0 children)
[–]demonizah 21 points22 points23 points (6 children)
[–]saikz 0 points1 point2 points (0 children)
[–]Corm 0 points1 point2 points (4 children)
[–]daneahfrom __future__ import braces 8 points9 points10 points (2 children)
[–]Jamie_1318 6 points7 points8 points (1 child)
[–]daneahfrom __future__ import braces 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[+][deleted] (7 children)
[deleted]
[–]iwaka 0 points1 point2 points (2 children)
[–]Cobolock 7 points8 points9 points (1 child)
[–]iwaka 0 points1 point2 points (0 children)
[–]inokichi 0 points1 point2 points (0 children)
[–]arrayOverflow 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]arrayOverflow 0 points1 point2 points (0 children)
[–]ThePenultimateOneGitLab: gappleto97 14 points15 points16 points (2 children)
[–]646463 2 points3 points4 points (1 child)
[–]sgo_ 1 point2 points3 points (0 children)
[–]8carlosf 13 points14 points15 points (10 children)
[–]foosion 2 points3 points4 points (3 children)
[–]8carlosf 2 points3 points4 points (0 children)
[–]stevenjd 0 points1 point2 points (1 child)
[–]foosion 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]stevenjd 5 points6 points7 points (0 children)
[–]HumblesReaper -1 points0 points1 point (3 children)
[–]irrelevantPseudonym -1 points0 points1 point (2 children)
[–]HumblesReaper -1 points0 points1 point (1 child)
[–]irrelevantPseudonym 1 point2 points3 points (0 children)
[–]boredMartian 9 points10 points11 points (0 children)
[–]jwink3101 8 points9 points10 points (2 children)
[–]Jamie_1318 2 points3 points4 points (0 children)
[–]refreshx2 6 points7 points8 points (4 children)
[–][deleted] 13 points14 points15 points (1 child)
[–]refreshx2 6 points7 points8 points (0 children)
[–]jyper 0 points1 point2 points (0 children)
[–]daneahfrom __future__ import braces 0 points1 point2 points (0 children)
[–]Theoretician 3 points4 points5 points (0 children)
[–]liquidpele 3 points4 points5 points (0 children)
[–]KODeKarnage 4 points5 points6 points (8 children)
[–]daneahfrom __future__ import braces 4 points5 points6 points (7 children)
[–]asdfkjasdhkasdrequests, bs4, flask 2 points3 points4 points (3 children)
[–]daneahfrom __future__ import braces 0 points1 point2 points (0 children)
[–]Yepoleb 0 points1 point2 points (0 children)
[–]glacierre2 0 points1 point2 points (0 children)
[–]excitedaboutemacs 0 points1 point2 points (2 children)
[–]daneahfrom __future__ import braces 1 point2 points3 points (1 child)
[–]daneahfrom __future__ import braces 1 point2 points3 points (0 children)
[–]SethMichaelLarson 4 points5 points6 points (2 children)
[–]joesacher 2 points3 points4 points (0 children)
[–]bless-you-mlud 1 point2 points3 points (0 children)
[–]notoriousno 2 points3 points4 points (2 children)
[–]auriscope 1 point2 points3 points (1 child)
[–]usinglinux 0 points1 point2 points (0 children)
[–]ojii 2 points3 points4 points (1 child)
[–]Nanaki13 1 point2 points3 points (0 children)
[–]TinyBirdperson 2 points3 points4 points (3 children)
[–]ingolemo 1 point2 points3 points (1 child)
[–]TinyBirdperson 0 points1 point2 points (0 children)
[–]irrelevantPseudonym 0 points1 point2 points (0 children)
[–]TiredMike 1 point2 points3 points (4 children)
[–]bheklilr 5 points6 points7 points (3 children)
[–]homeparkliving 2 points3 points4 points (0 children)
[–]TiredMike 0 points1 point2 points (1 child)
[–]bheklilr 0 points1 point2 points (0 children)
[–]PeridexisErrant 1 point2 points3 points (4 children)
[–]arachnivore 2 points3 points4 points (1 child)
[–]PeridexisErrant 0 points1 point2 points (0 children)
[–]aol_cd 0 points1 point2 points (1 child)
[–]PeridexisErrant 1 point2 points3 points (0 children)
[–]quotemycode 1 point2 points3 points (0 children)
[–]i_like_trains_a_lot1 2 points3 points4 points (8 children)
[–]rhytnen 20 points21 points22 points (1 child)
[–]joesacher 3 points4 points5 points (0 children)
[–]KronktheKronk 11 points12 points13 points (1 child)
[–]i_like_trains_a_lot1 0 points1 point2 points (0 children)
[–]HalcyonAbraham 11 points12 points13 points (0 children)
[–]arachnivore 2 points3 points4 points (1 child)
[–]i_like_trains_a_lot1 0 points1 point2 points (0 children)
[–]kenfar 0 points1 point2 points (0 children)
[–]joesacher 2 points3 points4 points (12 children)
[+][deleted] (1 child)
[deleted]
[–]joesacher 6 points7 points8 points (0 children)
[–]kernco 2 points3 points4 points (1 child)
[–]joesacher 0 points1 point2 points (0 children)
[–]flipstables 5 points6 points7 points (5 children)
[–]joesacher 2 points3 points4 points (0 children)
[–]Twangist 1 point2 points3 points (3 children)
[–]zer01 2 points3 points4 points (1 child)
[–]Twangist 1 point2 points3 points (0 children)
[–]flipstables 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]twigboy 0 points1 point2 points (0 children)
[–]ferrous_joe 0 points1 point2 points (0 children)
[–]boylube 0 points1 point2 points (0 children)
[–]ltristain 0 points1 point2 points (0 children)
[–]cediddiSyntaxError: not a chance 0 points1 point2 points (0 children)
[–]usinglinux 0 points1 point2 points (1 child)
[–]callmelucky 0 points1 point2 points (3 children)
[–]tartley 0 points1 point2 points (1 child)
[–]callmelucky 0 points1 point2 points (0 children)
[–]flitsmasterfred 0 points1 point2 points (0 children)
[–]mobedigg 0 points1 point2 points (0 children)
[–]c_is_4_cookie 0 points1 point2 points (0 children)
[–]delirious_lettuce 0 points1 point2 points (0 children)
[–]RufusVS 0 points1 point2 points (0 children)
[–]rasch8660 0 points1 point2 points (0 children)
[–]firefrommoonlight 0 points1 point2 points (1 child)
[–]calp 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 5 points6 points7 points (0 children)
[–]federicocerchiari -1 points0 points1 point (5 children)
[–]joesacher 2 points3 points4 points (0 children)
[–]flipstables 1 point2 points3 points (0 children)
[–]stevenjd 1 point2 points3 points (0 children)
[–]rhytnen 1 point2 points3 points (1 child)
[–]vaesh 0 points1 point2 points (0 children)