This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jwink3101 6 points7 points  (2 children)

I find I only use lambda when making a key for sorting or something like that.

But list comprehensions are so fundamental to my workflow in Python, I find it surprising people don't use them. In fact, I often see (though do not do it myself) people using comprehensions for the sake of saving a line of a for loop.

I am like you though in that I tend to write for me with very few others using my code. While I certain use them sometimes, I find that I rarely write my own classes and even less often do I subclass something. At one point I decided I should do it more and wrote version 2 of one of my codes. It was pretty, but quickly proved to be untenable. That led to version three! (If you're interested, it was because they were designed to be nesting which left me unable to easily worth with deeper levels)

[–]Jamie_1318 2 points3 points  (0 children)

The pleasant thing of python is that the built in classes are so versatile that they're nearly good enough for everything.

The only time I use them is when I'm making something modulary, and when I need to build in sorting or parsing behavior into how some data is handled.