Skip to main content

#100DaysOfCode, Day 014 – Classes, List Comprehensions and Generators

Did a video session again today, since I came back late from the doc.

Watched videos about building a small d&d game, using classes.
This was fun :)
Working on the challenge will be exciting.

And then some more on list comprehensions and generators.
I had one aha, about tools as I watched this.
The instructor used a regular expression to process a list and that little line, cut down his code by lots.
That made me realise that programming is simply picking up the right tool for the job, and that there are a plethora, to do the work you need to do. One is not necessarily better than the other, just that some are better suited to the job at hand, than others.
Revised how list comprehensions and generators work.
And like a dork, I just realised that the operative thing is comprehension. You write in a comprehensive way to build some sort of collection. A list comprehension to write lists, a dictionary comprehension to build a dictionary, a generator comprehension to … well, you get the idea :)

This is all I got for today.
Will work more tomorrow.