Love them or hate them, you can make functions take a variable number of arguments in Python

Photo by Fotis Fotopoulos on Unsplash

Depending on how you learned to program, you may love functions that take a variable number of arguments, or you may hate them. But it is hard to deny that there are cases where they make sense.

If you started out with C, you probably never minded variable argument lists…


A better way to loop

Photo by Thomas Kinto on Unsplash

As a very old C programmer, I find, sometimes, that I am writing C in whatever language I’m using. If you have this problem, you should look at other ways to more efficiently code in other languages like Python. …


And do some programming.

Photo by Pedro da Silva on Unsplash

Imagine you want to learn how to bowl. You can read a lot about bowling. There’s a lot to know. What’s a split? What’s a spare? How do you hold the ball? You can watch bowling on TV. But at some point, you’ll go as far…


Sometimes it is the little things…

Photo by Günter Valda on Unsplash

Have you ever noticed how little things are sometimes very convenient? Making coffee with grounds isn’t that hard, but we all like to pop in a pod. You can put your drink between your legs when you drive, but a nice car has cupholders. Some of the latest Python features…


Format strings quickly and easily

Photo by Bank Phrom on Unsplash

It seems like everyone’s first program is the proverbial “Hello World” or — here in Texas — “Howdy World.” But it isn’t long until you want to add changing things to your output strings or any string, for that matter. There are lots of ways to do that, but my…


Like IceCream on Steroids — You’ll Never Do Print Debugging Again

Photo by Alex Chumak on Unsplash

Just as there are stages of grief, there are stages of debugging. Stage 1 is just looking at your program trying to figure out what is wrong. Stage 2 is adding print statements in your code to print out key values. …


Threading can be easy, but not that easy…

Photo by John Anvik on Unsplash

Most modern computers have multiple processors or, at least, a fast context switch for a single processor. Even if you have one processor, there will be a lot of time it doesn’t have anything to do but wait for one program and…


Is there nowhere gdb can’t go?

Photo by Kevin Horvat on Unsplash

Unless you are superhuman, you’ll have bugs in your program. Many times you can use print statements to figure it out, but that’s not the best idea. Instead, you want a debugger. If your IDE provides one, it is probably only a shell around…


Learning a language is great, but you also need to learn your tools

Photo by John Schnobrich on Unsplash

There’s an old joke about a man who goes into a hardware store complaining he has to chop down dozens of trees in his back yard. The woman who owns the store tells him he needs a chainsaw. The man is resistant so she says, “Tell you what. You take…


Python, C++, JavaScript… none of those will make you a programming hero

Photo by Campaign Creators on Unsplash

Imagine you decide you want to write novels so you enroll in a class. On the first day, the instructor says, “Tolstoy, Nabokov, Dostoevsky, and Chekhov. These four authors are considered among the greatest novelists of all time and they are all Russian. …

Al Williams

Engineer. Author. Team Leader. Lots of other things. I blog about hardware hacking for Hackaday (www.hackaday.com), but talk about other topics here.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store