Dabbling with Python again
My relationship with Python is a coming-and-going one. I was recently chatting with Oliver and he asked me what I didn’t like of Python and I said the answer was subjective, but didn’t have an otherwise straight, concise, informed answer. It’s more about feeling, actually. I want to have a better answer.
I currently prefer Ruby to Python, but I want to like Python. I’m not interested on finding out which one is better or picking a winner, I want to be fluent on both languages and use whichever does the best job for the task. I wouldn’t rewrite my Ruby xdotool wrapper in Python, for example. And I wouldn’t rewrite my code generator written in PHP because PHP is something Python and Ruby are not: a templating language. Best tool for the job.
While I can do (and have done) stuff with Python, I don’t consider myself a good Python programmer. There’s lots of gaps in my knowledge. I don’t feel comfortable with it. There goes that feel thing again, dargh. Whatever, I just want to learn Python properly.
I rewrote my latest Ruby script to Python, it automates getting the day’s Zoom invitation for sending it to my church’s WhatsApp group. Surely there’s better, pythonic ways of doing things, but it works and it gave me a better understanding on how to do things in Python based on how I usually write them in Ruby.
And I learnt about assignment expressions. I didn’t know Python couldn’t do that and I’m glad they added them to the language already. The reason behind them was exactly what I stumbled with: having a condition where a regular expression matches and needing the match object assigned to a variable. I was like, “why can’t I assign in a condition?”