The Traveller's Last Journey DEDICATED TO SHAI MAROM Z"L

A map to a first stage of learning python

A

The atlas is filled with maps, and the roads twist and turn around short-cuts and panoramic views. Here is the advice of a singular traveller, still a beginner.

Where this begins

This begins where I did. Knowing about programming, and knowing a little about how to program. About 7 years ago I had self-taught a basic level of HTML, CSS (enough to write a basic website, or more likely, edit the code of an existing website), and javascript (enough to understand loops, but not enough to do anything practical). I had learned using w3schools. But it was a single burst of interest which soon petered out.

This biography may help others situate themselves along the axis of my recommendations.

Where to start

I started with codecademy. I found it by chance and liked it, and have seen it extensively recommended as a starting point. Not only is it accessible, but it is also intelligently designed, using various clever education stratagems, like switching between difficulty levels, and building skills one step at a time.

By the end of codecademy you can expect to be familiar with the basic phenomenon of programming (understanding what it is, what it looks like) and with the common tool, some of their utilities (esp. loops and variables), and a sense for how data can be manipulated and organized.

Next step

I moved onto Learn Python the Hard Way. I chose it because of recommendations, and because it served my purpose: achieve a stronger foundation for python before choosing any direction.

First a caveat and then a review: I did not always follow the course instructions. I did learn how to use the command prompt (invaluable), and make a game (invaluable), but I didn’t memorize anything, nor did I spend time reading code on GitHub, and I completely skipped the last few chapters.

It was a great experience. It taught me how to use classes – solidified by making a basic text game. It taught me how to use tools which are common in the trade, like pip, unittest (and nose). It made me aware of resources which are common in the trade, especially github and the standard library.

In retrospect, I have no regrets about the elements I skipped, because I don’t think I was ready to appreciate their lessons.

What does this mean for an aspiring student? If you’re computer savvy enough to get through the first couple of chapters, then LPTHW can be an invaluable experience (and if it’s too much, it may be a good second choice after another introductory course). It will teach you things you didn’t know you didn’t know, and which you won’t realize how valuable they will be until later. Don’t get caught up on all the extra-curricular activities the author sets up, although do spend at least a few minutes researching your options to decide what is and isn’t important to you.

By the end of LPTHW you can expect to be more comfortable with python basics. You will also begin to develop a confidence and appreciation for objects (classes), which are a way of organizing (and thinking about) your code. You will have finished your first small project (using objects), which will give you an appreciation for some of the strategic (macro) choices in designing a program. You will be aware of unittesting, which is a valuable tool for testing code. You will be aware of GitHub, which is an online community and database of code (which you can study, and which you can use as a resource to avoid reinventing the wheel). You will be aware of libraries and how to install them, which are code that you can call upon (once again to avoid reinventing the wheel). For most of these lessons (especially as I’ve listed them from unittesting onwards), you won’t appreciate their benefits until later. But just having them in the field of your awareness will prove to be very empowering, and fast forward the rest of your education.

Next steps and branching out

Here on out, I divide the path into three goals: creating a product, expanding your knowledge base, and developing your skill.

Skill development

By this, I mean writing intelligent code. By this, I mean (1) the capacity for problem-solving in code, (2) the capacity for problem-solving in a computationally efficient manner, and (3) making use of pre-existing tools (aka using wheels which have already been invented).

Creating a product will fortify all these skills, and expanding your knowledge base will give you the potential for #3.

But more directly, I recommend spending a given fraction of your study time to online challenges. I’ve used checkio and codewars, can recommend both, and know that others exist. These are ranked problems to be solved. After you’ve finished solving a problem, looking at others’ solutions is invaluable. It will give you ideas. I recommend making a note of solutions which appeal to you, and looking for opportunities (e.g. in future problems) to utilize their principles.

By challenging yourself with coding problems you can expect to be faster at finding solutions, become familiar with solution motifs, discover new ways of using the tools you already knew, and start to create solutions which impress you (for reasons of elegance, efficiency, or creativity).

Knowledge expansion

By this I mean an awareness and familiarity with python code and libraries. By this I mean (1) knowing how to make full use the core of the language, (2) knowing libraries available in (what’s called) the Python Standard Library, and (3) knowing libraries available outside the PSL.

Libraries are sets of code which you can import and use in your own code, using them as shortcuts (or blatantly as solutions) for your own goals. For example, instead of writing a code which can calculate the difference between dates, you could just import the PSL datetime library, and then just call the function timedelta to get the result (not necessarily caring how it got the result, but being confident that if its in the PSL its a highly honed, efficient calculation).

I recommend starting by studying the string library. If you’ve just come out of codecademy, LPTHW, and are doing online challenges, then this library (which is all about manipulating strings), will be immediately practical. I also recommend an early study of the “builtin functions” and “builtin types“, these will also include tools you can use straight away, and will also solidify your understanding of core principles.

The standard documentation is often usable, but a friendlier approach, and one I recommend is Python Module of the Week. This is a list of introductions to many of the PSL libraries, including string.

Later I recommend re-learning (or learning) how to use generator functions and conditional lists, after which you can make use of the ittertool library (for manipulating iterators). Beyond that, choose whatever interests you or that you’ve seen, or spend more time outside the PSL (returning when it has a tool that you want – Python Module of the Week will give you a feel for what’s available in the PSL).

Beyond the PSL

Moving beyond the PSL will depend on your interests. Common trajectories seem to be graphical interfaces, web frameworks, and web scraping. The latter could be approached by learning how to use Flask and scrapy respectively. I chose to learn graphical interfaces so chose to study pygame (but see also kivy).

The first drive here is a goal-oriented immersion in a library. This should fit with whatever program you want to learn to create.

I recommend finding an online tutorial (although if you’re confident enough you could dive straight into the documentation and application). Later, when you start using libraries which you’re not wholly invested in, it will be enough to learn just the functions you want to actually use. But for me, immersing myself in learning and using a large library (like pygame) gave me an appreciation for what libraries are, and how they fit into product creation. It also increased my flexibility in coding, teaching me to “think” like a particular library in order to make full use of its tools for achieving my own goal.

This is also the stage when you have some idea of what you’re interested in at the moment, and so GitHub will begin to be more interesting. Try googling site:github.com with the library you’re studying, and perhaps some keywords of problems or ideas you’re thinking about.

By this stage, exploration should be goal-oriented.

Prioritizing knowledge

When I’m looking for something to study, I use this ranking system: (1) What do I need right now, (2) what do I want to know, (3) what am I curious about.

When I’m studying a domain of knowledge, I use this protocol, asking myself: (1) Can I imagine using this in the foreseeable future (and if not, skip – be ruthless about this, there is too much to learn), (2) how can this thing be used (and making sure I know), (3) how could I use this (and imagining how).

Bonus points

At a certain stage in your education, there is one tool which has opened up entire vistas and paradigms of thought: pycon. These are python conferences with talks on myriad topics. Search by interest or blindly browse. Watch these when they are interesting to you.

Product creation

Having a project will give a context to your education, and help solidify anything you learn – firstly because of the way you’ll think as you study, and secondly by practice of the application.

Creating a project will reveal tools and skills beyond the sheer wall of code. This includes planning a project, its objects, its methods, its flow. This includes dealing with frustrations and setbacks, and persistence versus revision. This includes debugging and testing (and the benefits of using tools for doing so). This includes learning how to look for solutions and how to ask for help.

Time management

I have two modes I go into for scheduling myself. (1) Study mode – this is when there is a major new domain I want/need to learn (for something that I want to make), and (2) creation mode – this is when I am focused on completing or progressing in my product.

I like to use the pomodoro technique, which means that I think of time in terms of 25-minute blocks. Out of 6 blocks, I always spend one on general study. This is where I study something from a list of “interesting things I’ve come across”.

Then, if I’m in study mode: I’ll spend 1 block on my program. I’ll spend 3 blocks studying. And 1 block on online challenges.

If I’m in creation mode: I’ll spend 5 blocks on my program. Sometimes I’ll prioritize some of that time for writing unit tests, or pseudocode or brainstorming, to make sure I stay on track.

Coda

Learning can be a roller-coaster of frightening trepidation and exhilarating empowerment. When I’ve started learning new domains, and gotten a mean way into my first “big” project, I’ve gone through a period of being overwhelmed, “I can’t do this, this is so much more than I thought, it’ll take me years to get on top of this, there’s something here that I’m just not getting.” And there’s also been a certain point when learning new domains when it just clicks, and then I’m euphoric as I start to imagine all the things I can do with my newly minted skills.

Safe travels.

Print Friendly, PDF & Email

About the author

Add comment

By Pala
The Traveller's Last Journey DEDICATED TO SHAI MAROM Z"L

Search by Category

Search by Date

Shai