Category: Python

  • “Practice Makes Python” is now available for early-bird purchase

    My first ebook, “Practice Makes Python” — containing 50 exercises that will help to sharpen your Python skills — is now available for early-bird purchase! The book is already about 130 pages (and 26,000 words) long, containing about 40 exercises on such subjects as basic data structures, working with files, functional programming, and object-oriented development. But it’s not quite…

    Read more

  • In Python, it’s all about the attributes

    Newcomers to Python are often amazed to discover how easily we can create new classes. For example: class Foo(object): pass is a perfectly valid (if boring) class. We can even create instances of this class: f = Foo() This is a perfectly valid instance of Foo. Indeed, if we ask it to identify itself, we’ll find…

    Read more

  • Announcing: A free Webinar, and two online courses (functional Python and OO Python)

    It’s time again for me to offer a free Webinar, as well as two online courses: I’m repeating my hour-long free Webinar about functional programming in Python on Wednesday, October 22nd.  When I offered it last month, more than 200 people got tickets, and 70 participated.  I had a blast, and nearly 2,000 people have viewed…

    Read more

  • Sorting lists of dicts — an exercise from “Practice Makes Python”

    My ebook, Practice Makes Python, will go on pre-sale one week from today. The book is a collection of 50 exercises that I have used and refined when training people in Python in the United States, Europe, Israel, and China. I have found these exercises to be useful in helping people to go beyond Python’s…

    Read more

  • Thinking with “map”

    In the free Webinar I gave yesterday about functional programming, I mentioned that “map,” or its equivalent (e.g., Python’s list comprehensions), is a powerful tool that I use nearly every day. Once you get into the functional mode of thinking, you’re constantly finding ways to turn one collection into another collection. It’s a mindset that…

    Read more

  • The relative speeds of str.format and %

    My most recent blog post talked about the use of str.format instead of the % operator for interpolating values into strings. Some people who read the post wondered about their relative speeds. I should first note that my first response to this is: I don’t really care that much. I’m not saying that speed isn’t…

    Read more

  • Teaching an old dog new tricks — or, how I learned to love Python’s str.format, and gave up on %

    I have been programming in Python for many years. One of the things that I wondered, soon after starting to work in Python, was how you can get Perl-style variable interpolation. After all, Perl (like the Unix shell) supports two types of quotes — single quotes (in which everything is taken literally) and double quotes…

    Read more

  • Three Pythonic products: A (free) Webinar, a course, and an ebook

    I love developing software.  I also love helping people to learn how to develop better. That’s why I have been teaching programming classes for more than a decade, and why I write about programming. There is so much to learn; it’s a rare day on which I don’t learn something new, and it’s a rare…

    Read more

  • Summary of my “reduce” series

    I teach Ruby and Python to a lot of people — in formal courses, and in one-on-one pairing sessions, both online and in person.  I’ve found that for many people, the whole notion of functional programming seems strange and difficult, as well as something of a waste of time.  After all, if you have objects,…

    Read more

  • Implementing “filter” with “reduce”, in Ruby and Python

    We’re nearly at the end of my tour of the “reduce” function in Ruby and Python.  Just as I showed in the previous installment how we can implement the “map” function using “reduce”, I want to show how we can implement another functional-programming standard, “filter”, using “reduce” as well.  As before, I’ll show examples in…

    Read more