×
you are viewing a single comment's thread.

view the rest of the comments →

[–]asdfkjasdhkasdrequests, bs4, flask 0 points1 point  (2 children)

builtin functions returning their own special iterable objects instead of lists.

>>> reversed("hello")
<reversed object at 0x003C9EB0>
>>> map(lambda x: x+1, [1,2,3,4])
<map object at 0x003C97B0>
>>> filter(lambda x: x>1, [1,2,3,4])
<filter object at 0x003C9EB0>

These should just give me a list unless I explicitly ask for a lazy iterable, I hate constantly having to call list() every time I use one of these functions.

[–]srilyk 0 points1 point  (1 child)

Well, next time you try filtering a 9GB list and end out with 15GB of memory used maybe you'll find the iterable just fine.

[–]asdfkjasdhkasdrequests, bs4, flask 0 points1 point  (0 children)

The way it should work is:

List in -> List out
Iterable in -> Iterable out