Python Generators Part II - Under the hood
The main concept that has helped me grasp and use generators is the idea that a generator is an iterable function. I’m going to poke around briefly in the repl to show what methods are available to generators, and how Python uses them.
Rank Yourself! A Better Metric for Expertise
I’ve ranked my expertise a lot since getting into programming, conversationally, occupationally, and maybe even recreationally once I started to get into the habit. The job postings I see have level requirements: “Senior”, “Advanced”, or “Intermediate”. I hear about “Senior” vs “Junior” devs (and sometimes “Intermediate” here too). I get asked to rank myself, “Beginner”, “Intermediate”, “Advanced.” Or sometimes it’s “1-5”, or in a recent interview, “1-10”. I have opinions about this.
Python Generators
When I first heard about generators, it was in context of Python2, and the difference between range and xrange, xrange
being a generator function. In Python3, I learned, the original range
was removed, and xrange
was renamed range
. If you look up generators in Python, I can almost guarantee this will be the example you’ll see.
Bash Script - Renaming multiple folders
I saw an obvious way to clean up my hacker_rank
directory, and jumped into it. I had a series of directories from the Hacker Rank Python exercises in my root directory called collections_OrderedDict
, collections_defaultdict
, etc. And another series called itertools_groupby
, itertools_combinations
, etc.
After You Change GitHub Repo Name
I kept forgetting the steps to take, changing the GitHub remote URL and updating virtualenv paths. Here are the steps!
I Will Return
We had a two-week break at RC after my last post. I started working through Eloquent JavaScript over the break. Since returning, a handful of things have discouraged me from writing more blog posts.
Python List Comprehension
List comprehensions are a quick, easy way to create lists in Python. They offer a short, readable alternative to creating and editing lists using the lambda function and/or for-loops, and they’re considered a more Pythonic way to create and combine the functional methods filter()
, map()
.
The Map Method
The map()
method is a way to apply the effect of a function on every element in an iterable. It iterates over the iterable, and passes each element in turn into the function you provide it. Each of these return values are appended to a (new) list, which map()
returns.
Python Closures - Part III
We started playing around in the repl…
The Filter Method
The filter()
method is a way to filter through an iterable, using a boolean function as a sieve. It constructs a new iterable, filled with the elements from the original iterable that pass the criterion of your boolean function.
Lambdas (and Closures - Part II)
In Python, anonymous functions are declared with the lambda
keyword.
Python's Enumerate Method
This is a follow up to Python’s Iterables and Iterators
Introduction to Closures in Python
Proficiency: Beginner to Intermediate; I’m going to assume that closures are confusing to you.
Python's Iterables and Iterators
Python has iterables and iterators, both of which are invoked during iteration (or while iterating). This is one of those things that is confusing until it isn’t, and there isn’t a great way to narrow that gap.
Upgrading to Sublime Text 3
I kept having this error message come up on ST2, and it seems the solution was to install ST3.
Linux BASH Shortcuts
I have learned these useful terminal shortcuts. I use them a lot, so I’ll document them here:
Setting Up Learn.co on Ubuntu
When I first started on Learn.co, I was on Windows, and I used the Nitrous IDE, and they walk you through the set-up. I then used my girlfriend’s iMac, and the set-up was easy, and again they walk you through it.
Sublime Text 2 On Ubuntu
Note: I was getting this annoying error which seems to happen because I am on Ubuntu 14.04. Apparently upgrading to Sublime Text 3 will fix it. I am now in the process of installing and setting up ST3. I’ll post about that I’m sure.