THIS Is One Of The Fastest & Cleanest Ways To Filter Lists In Python

preview_player
Показать описание
This is one of the fastest and cleanest ways to filter your lists in vanilla Python.

▶ Become job-ready with Python:

▶ Follow me on Instagram:
Рекомендации по теме
Комментарии
Автор

In just two videos you've made me want to use the map and filter python functions. Clearly explained. Also great timing examples. 👌

thisoldproperty
Автор

I came across your channel a few days ago. I gotta admit, your small videos are much more informative than some longer ones out there. I love the small details provided too. Makes my day as I get to learn about things in Python I thought I had learned already.

md.masumomarjashim
Автор

Great video, straight to the point, exactly what I was looking for. Thanks for helping me understand filters in 5mins! Very valuable and great style btw!

nasenblick
Автор

The problem with filter is that if you convert the result to a list in the purpose to print it, the object will be empty next time it is used since it was already iterated over (same as map)

So if one really wants to manipulate a list and send it over you absolutely have to chain list and filter before assignment. Which is actually quite fine and functional.

zangdaarrmortpartout
Автор

It's a good comparison👏 A lot of people tend to code the way they are used to, rather than performance. It's just as important to optimize as to write working code.

pilgrim
Автор

The function you pass to filter does not have to return True or False. Filter can use the truthiness of the returned value to determine whether the value should be filtered out or not.

ricdelmar
Автор

Thanks, it's small aspects of Python like this that, as you say, may be useful, or may not, in particular circumstances. Regardless, it's great to see a demonstration, and know that filter() is an option.

cerealport
Автор

i like comprehensions alot, but for filtering not so much

KeithKazamaFlick
Автор

Why does 100K has an underscore in the middle?

mayorc
Автор

it probably wouldn't change the conclusions drawn, but using min is a poor way of evaluating the performance here. just change that to an avg. for future tests like these

slam
Автор

Hay, please can you to begger terminal, l doesn't see .😪😪😪

manarmimi
Автор

Hehe, aren't you former javascript guy? 😅

Forseti