Learning Python, A Rubyist's Perspective
Sat, Jun 8, 2019Python is not so different from Ruby. Both languages feel intuitive, like an old tool in your hand. They speak in simple words, and their libraries reach far and wide. But for a Rubyist, Python is also a little strange, like walking backward on a familiar road.
The Familiar
Python has wide libraries. For hardware, for dataframes, for GPUs. It’s fast too, compiled to C, with the option to run on GPUs. You can do things in Python that feel impossible in Ruby, like building an autonomous car or serving a TensorFlow model in a Flask API.
Reading Python feels natural. At first glance, its syntax echoes Ruby’s simplicity. You think, “I’ve got this.”
The Strange
Then you try to write Python, and the uncanny valley opens beneath you.
You want the length of a string? Ruby says string.size
. Python demands len(string)
. You think you can just cast a thing to a dictionary or list? Not so fast. You must explicitly convert it.
Indentation matters in Python. You miss a space, and the interpreter scolds you. It feels like high school all over again. Ruby lets you be a little messy. Python is the strict parent that makes you clean your room.
Pythonic Zealots
And then there’s the community. Python’s world is vast, full of thinkers and copy-pasters, visionaries and zealots. Share code that’s good enough in Ruby, and people will thank you. Do the same in Python, and someone might tell you your code is wrong—not broken, just not “Pythonic” enough.
It’s like building a house and being criticized for four layers of paint instead of three, while the critic ignores that the foundation is crooked.
This post does not mean I am leaving Ruby behind. Ruby is a king for web applications and hackathons, a joy for small to mid-sized projects. It’s the fast lane to building something beautiful, like Shopify or GitHub.
But Python is defintively worth your time. Deep learning, autonomous robots, and data engineering belong to Python’s domain. It will teach you things you never thought you’d need to know. But don’t let Python’s cult of perfection dull your instincts. Write code that works. Build things that matter.
And if someone tells you your code isn’t Pythonic, smile and ask them what they’ve built lately.