Forget Pythonic. Write code that works

tech
Date

Thursday August 1, 2024

Topics
tech

For the Python nerds: I’ve seen data scientists bashing notebooks for years. I was one of them.

Then I learned yesterday about nbdev and how Jeremy Howard and folks at Nixtla are building production grade software using…notebooks.

I was taken aback by Jeremy’s YouTube “I don’t write code like most Python programmers, but I have a reason for how I write it”.

I was also shocked how easy it was to read Nixtla’s documentation and source code. Shouldn’t that be the goal??

Unit tests at the bottom of the Python files where the functions are defined. Wait…that makes a ton of sense.

Wirh nbdev there’s no major emphasis on pep8. No black formatting. No like wrap at 80 characters.

And I realized: we put so much emphasis on convention and doing what others are doing.

I’m not saying pep8 or black are wrong. I like them. But Python is just a language. Don’t get sucked into “being pythonic”. If the code works, and it creates value, it serves its purpose.

I come from R where there are so many “dialects”. Compare base R vs the tidyverse. Worlds apart in how they build and test their code.

So…make your own dialect. Just don’t waste time trying to keep up with all the formatters and linters out there. Because who cares? It’s your code.

It’s okay to have you or your team have your own style.

_________________________

Bryan lives somewhere at the intersection of faith, fatherhood, and futurism and writes about tech, books, Christianity, gratitude, and whatever’s on his mind. If you liked reading, perhaps you’ll also like subscribing: