I'm not sure many of these one-liners make your code more fun to read.

The list comprehension example was good. But the map and filter examples would also have been far better as list comprehensions too. There are good uses for map and filter, but converting one list into another list isn't one of them. The filter example took 6 lines but could have easily been done as a simple one line list comprehension.

Why use reduce to sum a list of numbers, when you could just use sum()? Why use a lambda to create a function to add two number when you could just use add()? Why use list slicing to reverse a list when the reverse function is clearer and (you yourself claim) more efficient?

I don't mean to be negative, but these are presumably meant to be tips to help beginners improve their coding style, and I think some of them are actually not good practice. It might be worth modifying some of the examples a little.

Software developer. Java, Python, C++ etc. I write for pythoninformer.com and maintain the generativepy library.

Software developer. Java, Python, C++ etc. I write for pythoninformer.com and maintain the generativepy library.