Cover Photo I call gaining clarity by David Travis on Unsplash
Mine is the python debugger. I was a long holdout thinking that print statements were sufficient. That was untill I started having errors crop up in functions that took minutes to run. The thing that I most notably wish I would have known about is post_mortem.
Example
[ins] In [4]: def repeater(msg, repeats=1):
...: "repeats messages {repeats} number of times"
...: print(f'{msg}\n' * repeats)
[ins] In [5]: repeater('hi', 3)
hi
hi
hi
[ins] In [6]: repeater('hi', 'a')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-0ec595774c81> in <module>
----> 1 repeater('hi', 'a')
<ipython-input-4-530890de75cd> in repeater(msg, repeats)
1 def repeater(msg, repeats=1):
2 "repeats messages {repeats} number of times"
----> 3 print(f'{msg}\n' * repeats)
4
Debug with iPython/Jupyter
%debug
Vanilla Debug
import pdb
import sys
pdb.post_mortem(sys.last_traceback)
More
For more information about the debugger checkout the real python article. https://realpython.com/python-debugging-pdb/
Also keep a bookmark of the table of pdb commands from the article https://realpython.com/python-debugging-pdb/#essential-pdb-commands
Top comments (26)
Docker.
Docker is amazing, although it has some little things that bugger me a bit, it's a really powerful and easy to use tool.
The only thing I know about Docker is that it's perfect for warming my cold hands in the winter months :) I've used it before with 0 knowledge of what sorcery is going on under the hood. I'll probably change that one day.
I have recently started working with docker. Its quite amazing to work with. Your working environment can run almost anywhere!
job titles mean nothing, so you might as well use whatever is currently useful to your goals
contact me privately if you need to understand why and how to do it in your case
Reminds be a bit of Ken Colemans philosophy of taking small intensional steps to get you from where you are to where you want to be.
Unit testing and debugging, it's feels good to see when code coverage is >95%
I love sitting down to work on a project with good coverage and passing tests!
Too many times I walk into an old project with no tests and it isn't working 😭
Once in a while you get an opportunity to lead a project to start building an application from scratch. I feel lucky to be the one to guide, dictate and lead by example for my current one. Only thing is I need to make sure is timeline commitment to business is being met.
Balancing tech debt is a real challenge.
Nice! Realizing the value of debugger is a great step ahead.
This is not just a Python thing. It is coding in general. Being able to play around with the context within the runtime gives you so much more insight on how a language works.
This is pretty much the very first thing I try to figure out first when I start to learn a new language.
I am heavy user of print statement debugging. Long running commands introduced me to the debugger, post_mortem definitely has hooked me in!
well, not "recently", but "all time" is for me vuejs. i used to use jquery before, and vue completely changed the way i think in javascript. it's virtual DOM, encapsulation and modularity was a total banger.
also tought me a lot of new information about the DOM and it's rendering in browsers.
and when i recall how did i struggle some times to achieve something with jquery's spaghetti api, while with vuejs the same thing is easy as pie, i wish i learned it earlier.
I had a similar experience with react
Flutter/Dart, It's really nicely done (really good apps come out), I hoped to have learned it before Ionic : )
Flutter seems fascinating!
Yup, it's pretty cool! Worth giving it a shot.
Stupid simple code is better than smart elegant one.
The ability to understand and explain goes a long ways!
I bet that helps alot. I always find it amazing how much you learn about high level things by digging in underneath them.
Totally agree, knowing how a system works gives you a big advantage over those who don't (in some senses)
I would like learned writing React code better. Today I have improved it
I 💕 react. State management is amazing, and tools like gatsby, next, or create react app, make getting started so easy!
Setting up and securing a server. Pretty basic stuff for server admins but something I never had to do until I have built my personal site.
Personal sites are great for learning how to manage servers! We live in such a great era where you can get one so darn cheap, it's incredible. That is such a great skill to have.