Python module of the week

I know a lot of people don’t know about Python much. We might know about Java for instance, and how Java is bacon as to cheese when compared to javascript. Python does not have that problem, it has a perception problem though, that Python is only for data scientists and for super smart people who grok things like “immutable” and “everything is an object” or even worse, understanding why “super() is not super” and depends on your understanding firstly the Python “MRO”. And don’t start me on decorators, dictionary expansions, named parameters and list comprehensions. You actually don’t need to know half of these things to be really useful in Python.

I’m keen to learn a bit of Java too at some point, but not yet. After a few years of Pythoning (is that a thing?) I finally found a Python module that has been there for ages, but just hidden. I guess if you are diligent enough to follow things like the python module of the week Python 3 Module of the Week — PyMOTW 3 you will; know about the awesome pdb module already. But I did not. And it has blown my world away, I have so many questions, not just why did nobody tell me about this module before, but also why does almost nobody use it? I’m finding it really helpful in writing code where getting to an actual breakpoint is very time costly to be doing repeatedly and simple trace logging is not being helpful. Are there aha moments for you in your Test automation experience? Even if you don’t think your personal aha moment is noteworthy, tell me about it below, because you never know, we might be able to teach or just encourage.


I did tell about that package before :wink:
I’m amazed almost on a daily basis by the capabilities of Python. It can be used for so many different things.
Though no longer maintained, one of my aha moments was when I learned about docopt. A great package to add enhanced command line capabilities to your scripts.

1 Like

I haven’t used pdb but I have used the debug features in PyCharm which are pretty good. To be honest, I rarely do that as it’s generally easy enough for me to add a print or log statement and figure out what’s going on. If I’m at the point where I’m thinking about a debugger, I’m usually thinking “how do I make this simpler/more obvious what’s happening”.

I had no idea 3.8 added that = syntax to f-strings . . . thanks for that @pmichielsen!


The Pandas library took me a while to get my head round.

It enables you to apply operations on a dataframe to either get a new dataframe or change the existing one.

Basic filter in Pandas

No more loops just operations.


@pmichielsen I really do need to read more of your blog dude :slight_smile:
While I was looking into pdb I also saw a note on docopt - and am so keen to use it too for my next tool. I have however gotten pretty good at argparse, although I still hate argparse because things like parameter “sets” are not trivial to implement with it. So it’s definitely going to get a looking over.

@ernie What I want to know is why the JetBrains team on PyCharm (I’m moving over to intelliJ lately) does not use that interface at all. I’s just bizarre, maybe they tried to use it and failed. Even VSCode fails to leverage the module in their support for Python debugging.


@mranderson Pandas! Pandas, is way above my skill level, but it is so totally awesome. Been hacking on a weekend-warrior Raspberry pi project and am blown away by how cleverly constructed Pandas is. If even data-idiots like me can use it to plot lines from a 1GB CSV file, that alone makes it impressive in my books.