Ask HN: Beginner to Competent in Python: How would you approach it?

21 points by surds ↗ HN
Hello fellow HN users,

I expect to start a job soon where the main backend language is Python, with parts of Ruby and RoR in the stack. I have been a Ruby dev and have a beginner-level familiarity with Python - having read more than written.

How should I go about increasing my competency in the language to a decent level as fast as possible. I am talking about general fluency and knowledge about Python and not specific to the tech stack of the company.

I am sure there are excellent Python devs here and also devs who had to ramp up on the language for their job. As such, I thought I should get some guidance from the community.

Appreciate all opinions and pointers!

22 comments

[ 2.4 ms ] story [ 58.5 ms ] thread
Write more Python code.

Read Effective Python.

Write more Python code.

Already been reading. Time to work on the other two steps! :)
I've been really enjoying https://www.youtube.com/c/ArjanCodes and frequently watch one over my lunch break.

He covers a lot of programming principles and good practice with realistic examples (i.e. _not_ "class Animal")

* Python Distilled by Dave Beazley - "this concise handbook focuses on the essential core of the language, with updated code examples to illuminate how Python works and how to structure programs that can be more easily explained, tested, and debugged"

* Fluent Python by Luciano Ramalho — "takes you through Python’s core language features and libraries, and shows you how to make your code shorter, faster, and more readable at the same time"

I have more such Python resources here: https://learnbyexample.github.io/py_resources/intermediate.h...

That is a very nice resource list! Thanks for sharing!
Get the python cookbook and inhale it.
I think it has always been the case that practice makes perfect. If you want to be good at it, use it, start writing some personal projects, read source code of popular projects using python, learn best practices during the process and correcting yourself along the way.
Very practical tips. Thanks!
I find REPLs and IDEs a great way for learning the libraries and APIs by exploration.

Install iPython (the command line, not the notebook interface. The CLI is simpler). Install the libraries you will work with in your new software stack. Read the manuals, do the "hello worlds". Then type some variable and a question mark afterwords. This will show the documentation. Two question marks show the actual code of a particular function in question. This is great for digging around in the libraries. Many IDEs such as PyCharm have similar options when you have code and can navigate all the way down the rabbit hole in the libraries.

For many libraries in python, this attemp is not so useful. For instance, numpy delegates much work to actual C code and a lot of magic is involved.

Generally, Python has rather few specific syntax, compared to other languages. The language is rather small and you will spend more time on the libraries then on learning the actual language.

Similar situation to me about a year ago. I knew it would take me time to learn the quirks but if your new employer is happy for you to learn python then that is great.

The best way to learn is by doing.

Maybe play around with making a web or cli based tool between now and your start date.

Get familiar writing code in a good IDE

Yes, they are OK with that, but I'd like to ramp up as much as I can.

As to the IDE, I am assuming they would be using PyCharm and that should be familiar since I use RubyMine. I'll check.

Python the hard way would be good, but what do you want/need to do in the job, you might want to mention that! If you are doing webdev you should devote sometime to django/flask. I'm sure you can pick it up pretty quickly, it's less "weird" than ruby but I think most of your time might be getting up to speed on libraries.
Ha! I agree Ruby is probably weirder, even though I love it.

It's going to be Webdev with Flask. This is another vote for Python The Hard Way - will take a look at it, and get some hands-on time with Python.

If you want to be a good writer, read a lot of books.

You want to be a good python programmer, read other peoples code. Lots of it. Clone some big python projects and try to make changes. Get a feel for what is possible and look for common patterns in implementation.

You will always run into that classic mastery curve where initial success leads you to a false sense of mastery, before crashing hard and starting the actual climb to mastery. Get it over with as soon as you can by getting feedback on your early code, and don't take criticism personally.

(comment deleted)