Nevoic,

Python’s disdain for the industry standard is wild. Every other language made in the last 20 years has proper filtering that doesn’t require collecting the results back into a list after filtering like Java (granted it’s even more verbose in Java but that’s a low bar).

If Python had modern lambdas and filter was written in an inclusion or parametric polymorphic way, then you could write:


<span style="color:#323232;">new_results = results.filter(x -> x)
</span>

Many languages have shorthands to refer to variables too, so it wouldn’t be impossible to see:


<span style="color:#323232;">new_results = results.filter(_)
</span>

Of course in actual Python you’d instead see:


<span style="color:#323232;">new_results = list(filter(lambda x: x, results))
</span>

which is arguably worse than


<span style="color:#323232;">new_results = [x for x in results if x]
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • [email protected]
  • aaaaaaacccccccce
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • oklahoma
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • SuperSentai
  • feritale
  • KamenRider
  • All magazines