100 Days of code – 95% complete
Even though I’m 95 days in to my coding challenge, I’m still not really confident when it comes to classes. During the first 50 days or so, I thought that my lack of understanding of classes was some serious barrier I’d have to overcome.
Then I watched this.
I realized that about 90% of the classes I was seeing in other people’s code could have been a function instead. Since then, I’ve only built 1-2 classes, and everything else has been functions.
The new challenge is to somehow get music to play at the same time as the playback time updates. There’s probably easier ways to do it, but I’m using concurrent programming to solve this one. Concurrent programming in Python tends to mean using asyncio. After about 45 minutes of trying to get async to work, I realized that my main issue is that async relies on classes. And classes are mostly unnecessary.
So I decided to use gevent instead. Gevent seems to abstract a lot of the messiness of concurrent programming and just make it as easy as possible. I’m sure there’s a lot of good reasons to avoid abstraction and do concurrent programming the “correct” way, with asyncio, and classes, and everything else.
But isn’t abstraction one of the main draws of Python? If you want programming to be hard, why not just program in C?