Intro

Hello, welcome to my blog!

It is currently under construction. I’m still having some issues with setting up and configuring Hugo, which I use for the HTML content creation. I hope to resolve the issues soon, so stay tuned for content!

(Also I want to import my posts from my blog previously hosted at wordpress.com, which is a fun project but a bit of work in itself, so maybe soon there are going to be lots of interesting reads here!)

Best regards, Lexi

The hammer that turns every problem into a nail

Recently I asked a question on GitHub about some detail in the code of spaCy. Their founder of all the people, honnibal, called me condescending and presumptuous in return. I took offence at that at first, was irritated, but before I retorted with a snarky remark, I took a moment to breathe, and think about what he was actually saying. I realised that he was right. While I don’t consider myself to be condescending and/or presumptuous normally, my wording certainly had been: My question suggested I was telling the spaCy developers how to build an API for a complex python package – people who do this for a living, and whose code is recognised as one of the best NLP toolkits in the world.

Let’s look at the question honnibal rightfully took offence at.

while browsing the spacy API documentation I found some examples of java-style setters & getters, e. g. here and in this issue comment. I was wondering whether you do this on purpose? I ask because Python Anti-Patterns defines this as unpythonic, and recommends using @property decorators instead. My question is totally open to reasoning, I’m curious whether this is something you’d be interested to change or whether you made a conscious decision to do it, and if so why :)

(The highlights I’ve added only here, they’re not in the original question I linked above). It’s not hard to see why this had been taken badly. It was condescending. What I actually had intended to write was - eh, wait a minute. What was my intention, actually? I had to be honest with myself and find out why I had opened an issue for my question. Had I made a proper effort to come up with a possible answer to my question myself before I opened the issue? Had I done some research to find possible reasons for making such a design decision? Had I proofread my question, whereby I might have noticed the awkward and indeed presumptuous wording?

Sadly, but honestly - no. I had chosen to quickly post a question, because ‘it is only a quick question, right?’. That was not very respectful towards the developers, who have done a wonderful job of creating spaCy. And it was not very thoughtful on my side - I considered their time, which they had to spend to answer my question, less important than my own time, which I could have used to think before I wrote.

I’ve been called out on that, rightfully so, and I decided to apologise. But I wanted to take that a step further and think about the reasons for my actions. Why did I even compare the two possibilities of setting via an explicit set function vs. decorators and direct attribute access?

I finally figured out that I had made a very common mistake – finding a hammer and consequently seeing every new problem as a nail. I realised it when it occurred to me that I had spoken about the same thing in a Pull Request the other day, and the idea was not really applicable there, either.

For the future, I will have to keep in mind that there’s more than one way to do it, and it’s not always sensible to read about some programming paradigm and treat it as an absolute truth, or as honnibal put it:

In general rules-of-thumb will only go so far in any problem that comes down to balancing multiple trade-offs.

And a similar quote from The Hitchhiker’s Guide to Python:

We consider that a Python developer should know about these nearly infinite possibilities, because it instills confidence that no impassable problem will be on the way. However, knowing how and particularly when not to use them is very important.

I’m thankful for the explanation given by honnibal, and I’m positive that my own coding style can improve with this knowledge. I don’t want to be condescending. I don’t want to be presumptuous. I want to be open-minded, curious and ever-learning, respectful towards other developers all over the world. I don’t feel bad about being called out on that. It gives me a chance to improve myself, and become a better version of myself today already.