Iterable VS Iterator Explained In Python

Iterable VS Iterator Explained In Python

Indently

4 месяца назад

16,423 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@lostyguy7602
@lostyguy7602 - 16.08.2024 14:51

Could you explain how to use 'self'? like in def xyz(self): ?

Ответить
@ML_Enthusiast
@ML_Enthusiast - 16.08.2024 14:56

Useful and informative

Ответить
@khonello
@khonello - 16.08.2024 15:17

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.

Ответить
@adamz.6812
@adamz.6812 - 16.08.2024 15:39

Haha, the police

Ответить
@dipeshsamrawat7957
@dipeshsamrawat7957 - 16.08.2024 16:00

Thank you 😊

Ответить
@gehadgadallh9065
@gehadgadallh9065 - 16.08.2024 16:04

Thanks for knowledges.

Ответить
@rishiraj2548
@rishiraj2548 - 16.08.2024 16:27

🎉

Ответить
@syrupthesaiyanturtle
@syrupthesaiyanturtle - 16.08.2024 17:55

where do these fit in within python's built in data type hierarchy?

Ответить
@mr.g937
@mr.g937 - 16.08.2024 19:42

You should have imported these from `collections.abc`, not `typing`. That's the modern way to do it

Ответить
@cocoatea57
@cocoatea57 - 16.08.2024 21:04

Thanks

Ответить
@tigrux
@tigrux - 16.08.2024 21:07

Is there a fork of Python that enforces annotations in "compile" time or in runtime?

Ответить
@DggdgtCgjcg
@DggdgtCgjcg - 18.08.2024 14:58

How to make any auto login script using combo list tips make a video please

Ответить
@MasterSergius
@MasterSergius - 29.08.2024 14:04

If you have 'Luigi', then why you don't have 'Mario'?

Ответить
@goobiie
@goobiie - 18.09.2024 11:36

Excellent information!

Ответить
@pokerchannel6991
@pokerchannel6991 - 30.09.2024 01:20

hmmm that seems very similar to generators. I have made generators before that says next(some_gen) to increment to the next item

Ответить
@pokerchannel6991
@pokerchannel6991 - 30.09.2024 01:28

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

Ответить
@RoboArc
@RoboArc - 10.10.2024 02:35

How luch faster is this than just

For i in range(len(list_)):
Print( list[i] )

Lol

Ответить
@CorvoAttano-xu8bv
@CorvoAttano-xu8bv - 06.11.2024 13:58

too complicated , you start with a lot of data types and all sugary syntaxes. Could have just explained with the basic syntaxes.

Ответить
@jimalix6270
@jimalix6270 - 12.12.2024 21:11

Thanks!

Ответить