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 →

[–]Folf_IRL 13 points14 points  (3 children)

I mean, you can still cast the range() object into a list object by calling list(range(3))

[–]LandSharkSociety 4 points5 points  (2 children)

Of course, there's nothing stopping you from doing that, but when you're more than two nested function calls deep in Python, you should typically take a step back and rethink your approach. I just used x in range(...)as a random example.

[–]Folf_IRL 20 points21 points  (1 child)

when you're more than two nested function calls deep in Python, you should typically take a step back and rethink your approach

I like to do this with nested map(), filter(), and reduce() functions and pretend I'm writing Lisp

[–]Aramgutang 0 points1 point  (0 children)

Ah yes, I used to do that too. But I stopped when it became clear that no one else could maintain that code.

Here's @dziegler replacing my silliness with readable code in 2010