Тёмный

Python's Magical Itertools Module 

Tech With Tim
Подписаться 1,6 млн
Просмотров 80 тыс.
50% 1

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 72   
@ray30k
@ray30k 2 года назад
Comment before watching: Itertools has been a life-saver for a bunch of programming puzzles/challenges I've done recently, and I'm happy to see it get a moment in the spotlight!
@strydomobile
@strydomobile 2 года назад
Hi Tim, I've purchased programming expert IO a week back. So far I'm hooked on it and the fact that the tests gives you a bit of creative freedom makes solving the challenges a lot more fun. Thanks for the effort you put into your craft. It really means a lot for people like me who cant afford to go back to university.
@TechWithTim
@TechWithTim 2 года назад
Thanks for the feedback Chiral! I’m so happy you’re enjoying it, I didn’t put a TON of work into it :)
@Redditard
@Redditard 2 года назад
Sus
@imaginecloudsxo7987
@imaginecloudsxo7987 2 года назад
YESSS I had a lecture on this 2 weeks ago but I forgot everything bc the lecturer rushed through it. So thankful for this video!
@leonardsmith9870
@leonardsmith9870 2 года назад
Correction: All of python is magic, there's literally libraries for everything you can imagine
@francoisrioux5869
@francoisrioux5869 2 года назад
I work a lot with lists of nodes forming paths, knowing the pairwise function would have saved me a lot of headaches
@JohnMitchellCalif
@JohnMitchellCalif 8 месяцев назад
super useful and clear! Subscribed
@pravachanpatra4012
@pravachanpatra4012 2 года назад
Tim I loved the Django Authentication tutorial you made yesterday, can make more Django project tutorials?
@markwiygul6356
@markwiygul6356 2 года назад
Great work... You're videos are sharp and keep getting sharper!
@Mehavenonameyet
@Mehavenonameyet 2 года назад
I have to say this was 'magical'. So many itertool fuctions I did not know about explained well. So many times I could have been using itertools rather than loops.
@user-cc8kb
@user-cc8kb 2 года назад
Great tutorial! Thanks! :)
@chessstudent8797
@chessstudent8797 2 года назад
Another information that I don't know about Python. Very impressive that they are codes that make it more easier lol
@excelwithmark
@excelwithmark 2 года назад
Love it love learning from each of your videos
@tushensu
@tushensu 2 года назад
Great video Tim, I am buying the course today!!!!!
@Jmignet
@Jmignet 2 года назад
That looks extremely useful! For the repeat and the chain (from_iterable) functions, I felt like they could be more easily achieved with comprehensions and simple list concatenation/appending. All, of that if the objects to be repeated would not be large enough as to worry about memory management. Is that the case or am I missing something? For a moment, I thought that the chain.from_iterable function could have some extra functionality by maybe "unpacking" a list within a list. But I tested and it was not the case: chain.from_iterable_example([[1, 2, 3], [4, 5, 6], [[7, 8, 9]]]) prints: [1, 2, 3, 4, 5, 6, [7, 8, 9]]
@gzbin365
@gzbin365 2 года назад
pairwise() only in python Version 3.10 and above
@sethdon1100
@sethdon1100 Год назад
In case your version don’t have it, here’s the source code that works: def pairwise(iterable): if len(iterable)
@svantepanter
@svantepanter 2 года назад
Great video and walkthrough! Do you think one of the functions could be used as a part of a sudoku table-generator?
@Jacuav
@Jacuav 2 года назад
Never used this module before, thanks for bringing this up. I can definitely see this saving me a lot of time. Great work 👍
@InspektorDreyfus
@InspektorDreyfus 2 года назад
Actually the term combinatronic sounds even more techie. 🤪
@ITS_N3.LL.Y
@ITS_N3.LL.Y 2 года назад
Thank you for the great content men!
@GAUTAMSHARMA-xu7bl
@GAUTAMSHARMA-xu7bl Год назад
Nice work.
@alexybogomolov
@alexybogomolov 2 года назад
Combinatronic 😁
@sid.h
@sid.h 2 года назад
At 3:30, I think this is bad design. `for x in l` is usually interpreted as "for each item in l", a shorthand for a `for (int i = 0; i < l.size(); i++) {}` style loop. For me, coming from other languages, this would be an unexpected behaviour and I can imagine how it could lead to head-into-wall type bugs.
@alexolson124
@alexolson124 2 года назад
Thanks mann!
@bencipherx
@bencipherx 2 года назад
You mean in the iterator sequence 3:30
@emanuelkokovics
@emanuelkokovics 2 года назад
But what if we implement everything you said but how it is internally implemented in python; then it will be as efficient.
@Songfugel
@Songfugel 2 года назад
This video is worth watching even just for the iterator introduction alone Very important point at 8:00 left unmentioned. In the case of for vs while ALWAYS use for in python if you can over while. While is the more generic of them and running on python, for however is a highly optimized C-implementation that is a LOT faster and efficient than using while.
@its_code
@its_code 2 года назад
Really informative 👍❤️❤️👌
@tcgvsocg1458
@tcgvsocg1458 2 года назад
really good...can you do a video on screen video recorder but without using any modul or import?
@abab-ot7rn
@abab-ot7rn 2 года назад
Hello brother i have been watching u for like more than 2 years but i wanna know how u manages to learn many languages like c++,pytjon ,js simultaneously.. and u also learning many algo.and otjer concepts along with them.. could u pls share your ideas how u mamage all. And stil be the best at many things
@fustigate8933
@fustigate8933 2 года назад
Thanks
@meesiphht2769
@meesiphht2769 2 года назад
Iter-done!!!!
@Nathan-ng1kp
@Nathan-ng1kp 2 года назад
thank you core developers for "automating the boring stuff"
@mahdinouira3261
@mahdinouira3261 Год назад
im new to python how can i make this work : class MyNumbers: def __init__(self, fname, lname): self.firstname = fname self.lastname = lname def __iter__(self): self.a = 1 return self def __next__(self): if self.a
@SkyFly19853
@SkyFly19853 2 года назад
Nice!
@first-thoughtgiver-of-will2456
@first-thoughtgiver-of-will2456 2 года назад
If you're really into the iterable collections paradigm I'd recommend Java (8 and beyond) and Rust in that order. In my experience these are the best iteration languages currently. Pythons list comprehension is interesting but without method chaining I feel python iterables are a little too verbose and less readable at a glance. Map reduce type lambda methods give you prior knowledge before you even know what the code does and that's very important in functional programming where things get abstracted very quickly and iterations where things get nested quickly.
@sid.h
@sid.h 2 года назад
One word. Kotlin! Kotlin kotlin kotlin kotlin kotlin.
@abbasdehghanzadeh5903
@abbasdehghanzadeh5903 2 года назад
Great:👍👍
@shujamukhtar4563
@shujamukhtar4563 2 года назад
Hi there Tim. Have you announced the 3080ti giveaway?
@chrysos
@chrysos 2 года назад
Isnt a normal calculation as efficient as a generator + list() ?
@vinayakram5133
@vinayakram5133 2 года назад
Also need Tkinter , kivy tutorials tim....
@madhousenetwork
@madhousenetwork 2 года назад
Did "Nuttertools" cheat from GTA vice City strike for anyone?
@MrDazzlerdarren
@MrDazzlerdarren 2 года назад
Google the word "Iteration", it's my favourite Easter egg.
@dragonsage6909
@dragonsage6909 2 года назад
Cool.. but yes, python is alwaus magical.. thanks!
@relytheone853
@relytheone853 2 года назад
You should use the inconsolata font on your editor.
@bhartiwadhwa9241
@bhartiwadhwa9241 2 года назад
Mann could please 🥺 make a video on machine learning in python would help soooooooo much. Thanks to you in advance😀
@TechWithTim
@TechWithTim 2 года назад
I have a bunch!
@fogsterded
@fogsterded 2 года назад
He actualy did 7h long video of ML… juste watch his channel
@bhartiwadhwa9241
@bhartiwadhwa9241 2 года назад
Ohhh well that's great actually thankyou for mentioning it😀🤩
@bhartiwadhwa9241
@bhartiwadhwa9241 2 года назад
@@TechWithTim Big fan of you brooo
@ryanyeager969
@ryanyeager969 2 года назад
python is the future
@U53RN07F0UND
@U53RN07F0UND 2 года назад
"Combinatronic" lol
@SosaiOyama
@SosaiOyama 2 года назад
So iterables are linked lists
@brettpeace9858
@brettpeace9858 2 года назад
Itertools is highly useful... The presenter needs to learn how to present though!!
@illegalsmirf
@illegalsmirf 2 года назад
If all you want to do is print out 1 to 10, isn't there a simpler way to do it?
@richardbloemenkamp8532
@richardbloemenkamp8532 2 года назад
list is your friend to get around these annoying iterators and iteratables: print(list(range(1,11)))
@adiaphoros6842
@adiaphoros6842 2 года назад
If all you want to do is print 1 to 10, then a simple for loop using range() is enough. for i in range(10): print(i+1) Or if you want it the more “pythonic” way, use list comprehension: print([(i+1) for i in range(10)])
@illegalsmirf
@illegalsmirf 2 года назад
@@adiaphoros6842 I thought pythonic meant there is generally one way and not half a dozen ways of doing the same thing - which fills up the print with useless knowledge
@adiaphoros6842
@adiaphoros6842 2 года назад
@@illegalsmirf From what I read “pythonic” means “idiomatic in python,” which to me means “removing for loops through built-in functions.” But, I don’t know what I’m talking about, since I rarely program “pythonically,” because I’m more used to C, C#, and Java.
@serta5727
@serta5727 2 года назад
Let’s see what it can do 🤓
@codeatemail
@codeatemail 2 года назад
love from India
@kingleo429
@kingleo429 2 года назад
Python is technically programming god. It can do anything.
@danielzoref
@danielzoref 2 года назад
10
@xlerb_again_to_music7908
@xlerb_again_to_music7908 2 года назад
Tim, too fast. Loading up pupils with stuff you know @ speed you narrate allows no time for their cognition i.e. internally comprehend and absorb new learning. Suggest building in breaks of some form, so they can process what is going on.
@illegalsmirf
@illegalsmirf 2 года назад
With Python you should never write anything from scratch, always import
@richardbloemenkamp8532
@richardbloemenkamp8532 2 года назад
The only thing you need to do is remember a few hundred libraries with a few hundred functions each. That is indeed much simpler ;~). But it will be more readable: Answer: No, only for other people who prefer memorizing the same libraries and functions. I did a test and most of my testers agree that it looks more elegant but when you ask them what the code actually does you get fewer correct answers. But the performance is better if you do that. Answer: If you need performance you better skip Python altogether. But it has great function like permutations and combinations. Answer, when was the last time you actually programmed permutation or combinations of lists? Most programmers never use them. I more or less agree with Linus Torvalds that the C syntax is enough.
@unknownman5296
@unknownman5296 2 года назад
is this an April fools day video ??
@nakedonthebeach
@nakedonthebeach 2 года назад
See also module "more_itertools" (installed best via pip).
@Betabdullah
@Betabdullah 2 года назад
Thanks
@abbasdehghanzadeh5903
@abbasdehghanzadeh5903 2 года назад
Great:👍👍
Далее
Please Master These 10 Python Functions…
22:17
Просмотров 169 тыс.
Python Generators Explained
28:37
Просмотров 155 тыс.
БАГ ЕЩЕ РАБОТАЕТ?
00:26
Просмотров 236 тыс.
I Built a SECRET Lamborghini Dealership!
33:02
Просмотров 10 млн
A Deep Dive Into Iterators and Itertools in Python
21:01
Python itertools - The key to mastering iteration
20:03
How To Practice Programming So You Actually Get Good
15:46
STOP Making These Python Mistakes
19:16
Просмотров 112 тыс.
Async for loops in Python
16:36
Просмотров 64 тыс.
Python Logging - Tutorial
15:02
Просмотров 162 тыс.
5 Useful Dunder Methods In Python
16:10
Просмотров 60 тыс.
This Is Why Python Data Classes Are Awesome
22:19
Просмотров 808 тыс.
10 Python Shortcuts You Need To Know
27:27
Просмотров 294 тыс.