Since graduating from Flatiron School, I’ve been in this state of “choose your adventure” mode. It’s been up to me to decide what projects I want to work on, so I opted to learn a new language: Python.
So why Python?
The decision to learn python was mostly a career move. Many companies use it. It’s versatile. It helps to learn another popular language. It’s also easy to pick up. There are a lot of upsides, so why not? That said, it’s still weird transitioning from languages that I used frequently during boot camp (Javascript and Ruby), so there’s still an adjustment period.
I’m also making my way to utilizing Python as the backend language in the stack, so eventually, you’ll see posts about Django and Flash in the future.
Similarities and differences between the two languages I’ve noticed thus far
Before I start, I want to preface my blog by saying that spent a lot of my time in boot camp (15 weeks) using ruby in some capacity. Also, I was focused on learning to code exclusively. Comparatively, I’ve only spent a month working in python (not to mention job hunting and other responsibilities on top of that) so my bias is going to show. At the same time, it’s been fun trying to translate what I could do with Ruby into and see how I could do the same with Python.
Similarities thus far
- Both languages are dynamically typed, meaning that I can use a variable without declaring it first. How convenient!
- Both support object-oriented programming.
- Both use brackets ( ‘[ ]’ ) for lists, and curly braces ( ‘{ }’ ) for dictionaries (or hashes, as they call in ruby)
But, oh so many differences
Philosophies of the languages
One huge difference that I’m coming across has to do with the differing “design” philosophies of the languages. One thing that I’ve come to appreciate with the Ruby language is its flexibility. There are many solutions to a problem. With that flexibility comes a critique when it comes to debugging. Programmers would potentially have to pour through code to see what the issue truly is.
On the flip side, Python leans toward having simplicity. There should be one right answer to a problem. Less guesswork, but less flexibility. That’s not to say I don’t like it. No language is perfect. Just like tools, different languages serve different needs.
Code Blocks
Python uses white space to determine when code blocks begin and end. Ruby uses “def” and “end”. Getting used to the white space portion has been one of the bigger things to get used to.
Varying degrees of truthiness
Python’s boolean values are ‘True’ and ‘False’ (capital) while Ruby’s is ‘true’ and ‘false’.
In Ruby only false and nil are falsey. Everything else is truthy (yes, even 0 is truthy). In Python, 0, empty arrays, strings, and hashes all count as false.
Conclusion
My coding journey is still in its infancy. I still have lots to learn and I’m embracing all of it. As the journey continues, I’ll key you in as I wade through more python projects.
See you then!