DEV Community

prog-24
prog-24

Posted on

So .. I coded in Python

I have been using PHP for as long as I can remember. However, recently, I decided to pick up another programming language. As an API developer, one of the my biggest searches when building scalable APIs is how much requests can the api take before giving up.

Photo by Markus Spiske: https://www.pexels.com/photo/black-laptop-computer-turned-on-showing-computer-codes-177598/

I initially attempted to learn Scala but that syntax looked like hieroglyphics to me and the set up was just way to cumbersome. I also tried working on other (backend) languages like Go and even NodeJS. By the way, Scala is really fast. No seriously!

Finally, I decided to give Python a real go (no pun intended). It was tedious at first, you had to indent properly. A case of a missing line can cost you sleepless debug minutes.

Then you have random variables like ***kwargs* and the rest. Sigh.

After breaking through the initial barriers however, I started to appreciate the language some more. I learnt about list comprehension, the difference between (lists) and dicts, strict typings and my personal favourite; Protocols.
Photo by Markus Spiske: https://www.pexels.com/photo/black-laptop-computer-turned-on-showing-computer-codes-177598/

Also, great thanks to the team at Django for an awesome framework, definitely made things a lot smoother. I have now completed my first project that I will be shipping into production this week. What a journey it has been. Sure it could have been easier with PHP, but back to the latency issue. My code looks more succint and chops through tasks at an alarming rate (this is a good thing).

So if you are looking for a part time language, pick Python. I mean, look at this beauty:

        if res.ok:
            response_body = json.loads(res.content)
            web_ids = {item['reference']: item['id'] for item in response_body['data']}
            cases = [When(reference=key, then=value) for key, value in web_ids.items()]
            Place.objects.filter(reference__in=web_ids.keys()).update(webId=Case(*cases))
Enter fullscreen mode Exit fullscreen mode

Here is an AI generated joke for you:

Why do Python programmers prefer dark mode?

Because light attracts bugs!

Top comments (0)