Using a book as an example. The book is the iterable, the pages are the items in the iterable [ item1, item2 ]. You going through the pages is what is technically referred to as iterating. So an iterator is what enables you to go through an iterable. It is what allows you to go through the pages. An iterable is a collection of items. Python by default provides different types of iterators for each type of iterable, each iterator has it only unique benefits. You can create your own. Example: A generator object is an iterator.
@@DrDeuteron You are using a very specific example edge case to debunk my whole explanation, which is very wrong. And what you are saying best fit a ‘Generator’ object.
Self is just used within classes to specify that its an instance of the class itself. It also makes the variable accessible in the class from anywhere.
Oh I came to argue because I thought there was some difference but I checked pep, docs and last one source where is written that alias in typing is deprecated so I must agree you are right
Thanks!
Thanks for the support!
Using a book as an example.
The book is the iterable, the pages are the items in the iterable [ item1, item2 ].
You going through the pages is what is technically referred to as iterating.
So an iterator is what enables you to go through an iterable.
It is what allows you to go through the pages.
An iterable is a collection of items.
Python by default provides different types of iterators for each type of iterable, each iterator has it only unique benefits. You can create your own. Example: A generator object is an iterator.
but no. A book is a sequence. iter(book) is the iterator. I mean when you read a page, is it gone forever?
@@DrDeuteron Am not getting the point you are trying to make here.
yeh, no. Your right. Books are iterable. Now an online book that gives you one page at a time, once, is an iterator.
@@DrDeuteron You are using a very specific example edge case to debunk my whole explanation, which is very wrong.
And what you are saying best fit a ‘Generator’ object.
To continue your analogy - an iterator is a bookmark, and iterable is the book
Useful and informative
++
Excellent information!
nice. I use generators by yielding. and I like making them infinite so there is no running out of elements. Won't throw an exception
Could you explain how to use 'self'? like in def xyz(self): ?
I'll try to make the next video specifically about that
What is self, don't hurt me, don't hurt me, no more...
**beat drop**
Self is just used within classes to specify that its an instance of the class itself. It also makes the variable accessible in the class from anywhere.
@@Indently python is all about pop culture refs...
@@Indently At first I thought 'how could he not know' and then I realized...
You should have imported these from `collections.abc`, not `typing`. That's the modern way to do it
Oh I came to argue because I thought there was some difference but I checked pep, docs and last one source where is written that alias in typing is deprecated so I must agree you are right
Thanks for knowledges.
Is there a fork of Python that enforces annotations in "compile" time or in runtime?
You mean Java
@@MichielvanderBlonk Kotlin in that case.
Nope. I've been playing with 3.14, the version I'll call Pi-thon, and even it doesn't enforce type annotations.
mypy
Thank you 😊
hmmm that seems very similar to generators. I have made generators before that says next(some_gen) to increment to the next item
where do these fit in within python's built in data type hierarchy?
3:58 also pls explain how the 'yield from range(n)' works
5:00 😂😂
Thanks
Haha, the police
If you have 'Luigi', then why you don't have 'Mario'?
How luch faster is this than just
For i in range(len(list_)):
Print( list[i] )
Lol
🎉
How to make any auto login script using combo list tips make a video please
too complicated , you start with a lot of data types and all sugary syntaxes. Could have just explained with the basic syntaxes.