Quote:
Originally Posted by eschwartz
Actually this is not strictly true, they create iterables on py3 and `for i in iterable` works, as does `' '.join(iterable)`. What doesn't work is len(iterable) or iterable[0], and in many, but not all cases, FanFicFare needs to save variables that will later be consumed that way -- but the difference between py2 and py3 is that py2's map() is py3's list(map()).
|
I'm not going to argue the point. All I know is that code that worked in Py2 failed in
spectacularly obscure ways when I was making the FFF CLI run in Py3.
And rather than worry about the esoteric details about how and why they are different, I decided filter() & map() are simply broken and not to be used in code that needs to run on both Py2 and Py3.
Quote:
Originally Posted by eschwartz
That being said, there are many who would say filter is un-pythonic. It's sort of a bikeshed issue whether to surround everything with list() or replace it with list comprehensions.
|
From what I understand (which I admit is very shallow), they were the 'pythonic' solutions before list comprehension came along to avoid writing loops and were extremely common. In my ignorance, I copied them from older code which probably copied from even older code.
Okay, I may be arguing the point a bit after all...