Collections in Python - Advanced Python 06 - Programming Tutorial
HTML-код
- Опубликовано: 29 янв 2025
- Collections in Python - Advanced Python 06 - Programming Tutorial
In this Python Advanced Tutorial, we will be learning about the collections module in Python. The collections module implements special container datatypes and provides alternatives with some additional functionality compared to the general built-in containers, like dict, list, or tuple.
~~~~~~~~~~~~~~ GREAT PLUGINS FOR YOUR CODE EDITOR ~~~~~~~~~~~~~~
✅ Write cleaner code with Sourcery: sourcery.ai/?u... *
📚 Get my FREE NumPy Handbook:
www.python-eng...
📓 Notebooks available on Patreon:
/ patrickloeber
⭐ Join Our Discord : / discord
We will be talking about 5 different types from the collections module: The Counter, the namedtuple, the OrderedDict, the defaultdict, and the deque.
A written Tutorial can be found here:
www.python-eng...
You can find me here:
Website: www.python-eng...
Twitter: / patloeber
GitHub: github.com/pat...
#Python
----------------------------------------------------------------------------------------------------------
This is a sponsored or an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏
There are many demanding money for this detailed explanation and offering their paid courses,but you came out different and helping us.Thanks Buddy this means a lot ♥️♥️
the best crash course python tutorial series I've ever found
How are you not famous? This was so clear!
Haha Thanks 😊
Man, your tutorials are nice and explaining good stuff in details with implementation, thanks for this.
I really like your tutorials. You do a very good job. Thank you for your efforts helping others like me.
Thanks for watching! I'm glad that you like it :)
This tutorial deserves more views! Great explaination buddy :)
Thanks :)
i know it's quite off topic but does anyone know a good place to watch new series online?
Great summary of Collections, thank you
Glad you like it!
Thank You So Much for This Amazing Lecture 🥰
Completed The Lecture Video - 6 on 1/12/2024 ✅
My Son Loved it Thank you
Great tutorial! I wish the adds didn't pop up so often interrupting the video.
That is interesting. Can you use objects like tuples in counter? I think it would be more efficient to use a simple mean function or something, but might be helpful at some point to use counter with objects. 🤔
well done !!
The best video buddy.. :D.. You got a new subscriber
Thank you :)
Very very useful :)
Thank you !
Great tutorial, thanks mate!
Thanks 😊
Thank you so much for your help
EXCELLENT !!!
Myexpectationset = {"Great", "fast"," logical"," memorizable"} if Myexpectationset : print ("Yes") --->output ---> Yes
Nice :D
Thanks
Fantastic!
Hey Python Engineer Which add-ons you are using for python development for sublime...
I'm using VS Code, Python Extension, pylint, and Code Runner Extension
thanks sir
Best Regards
Great tutorials, Of much help
Thanks! Glad you like it
thank you
Amazing tutorial. Why was chainmap left out ?
Great video
thank you :)
I subscribed by the way
Thank you :)
Here one more subscriber !! Thanks to @Florin pop 🤚🏻
Cool :) I’m happy that you found your way here!
@@patloeber really excited to see more videos....hope vl go with some framework (flask or something else) too.....you have blessed with great voice.......cheers
what IDE are you using. Looks like you are on a Mac. I like that output view window on the bottom.
VS Code on the Mac, but it's cross-platform. It has an integrated terminal which I use for the output window.
Here is my suggestion to make this video more effective. Instead of deleting the lines, just comment them so that what you did is still there.
How can we remove the keyword deque that is appearing while we print the object.
Is there a reason to use list(.elements) method when one could just use list(a)? I am asking because you mentioned how tuple is more useful than list as in tuple being a lot faster than lists
I'm not exactly sure what you mean? where in the video do i use list(elements)? with this syntax we simple create a list based on different elements. A tuple is not more useful in general. But it makes sense to use a tuple when you have a lot of elements and know that they are immutable. And yes then it has some performance advantages...
I think he means
"What's a point of doing
list(my_counter.elements()) instead list(a)"
I keep expecting you to start using redstone and pistons.
defaultdict can i specifiy to return specific value?for instance d=55
you can do it with a little trick: my_dict = defaultdict(lambda: 55)
hacker examples for named tuple good
Wheres chainmap?
Thanks for the tutorial. What is the realtime implementation/use of namedTuple when we already have classes and objects ?
Very good question! namedtuples are immutable, so you so would use them when you want the attributes stay fixed. Or when you don't need a full blown class but still want readable code. namedtuples are implemented a little bit more memory efficient than classes (because of this immutability). Moreover, namedtuples allow for more readable code, since the tuples are "self-documenting". sometimes it can also be better to use theme over a dictionary or normal tuple when you want to pass around immutable objects in your code.
@@patloeberComprehensively answered. Thanks a million!!
Comment on the las line 'somtimes it can aslo .... in your code'. aren't tuples immutable in the first place ? so why create a namedtuple if i am looking for immutability, and not a simple tuple ?
Good video. However I am confused as to why you can pass the string 'x,y' when defining the namedtuple point and it recognizes it as 2 different attributes from the point class. Why does this work? Can you just list class attributes in a namedtuple like 'attr1,attr2,attr3' in the same string?
EDIT: read the docs for nametuple which have this to say: "Alternatively, field_names can be a single string with each fieldname separated by whitespace and/or commas, for example 'x y' or 'x, y'." For those wondering the same.
€500 , he has a lot of Indian colleagues.
how to send you money
please pronounce it as DQ
Oh dear, the defaultdict is SO poorly explained....
thanks