Iterable - это объект по которому можно пройтись. Для питона это любой объект у которого есть метод __iter__ или __getitem__.
Чтобы преобразовать какой то объект в list, нужно проитерироваться по объекту, т.е. вызвать iter(iterable). Первым делом смотриться метод __iter__, если он возвращает iterator, то переберая все элементы итератора строиться list. Но если у объекта нет метода __iter__, но есть метод __getitem__, то создается iterator на основе этого метода. В метод __getitem__ по очередно передаются индексы (просто числа) от 0 до момента пока __getitem__ не выбросит ошибку StopIteration или IndexError.
Для чего это нужно? На самом деле это очень старый механизм и в реальности почти не нужный. Так называемая "legacy feature". Но может быть полезен, когда у вас есть какой то объект и вы хотите как то проитерироваться по нему.
class Library: def __init__(self, books: list): self.books = books
Iterable - это объект по которому можно пройтись. Для питона это любой объект у которого есть метод __iter__ или __getitem__.
Чтобы преобразовать какой то объект в list, нужно проитерироваться по объекту, т.е. вызвать iter(iterable). Первым делом смотриться метод __iter__, если он возвращает iterator, то переберая все элементы итератора строиться list. Но если у объекта нет метода __iter__, но есть метод __getitem__, то создается iterator на основе этого метода. В метод __getitem__ по очередно передаются индексы (просто числа) от 0 до момента пока __getitem__ не выбросит ошибку StopIteration или IndexError.
Для чего это нужно? На самом деле это очень старый механизм и в реальности почти не нужный. Так называемая "legacy feature". Но может быть полезен, когда у вас есть какой то объект и вы хотите как то проитерироваться по нему.
class Library: def __init__(self, books: list): self.books = books
Cryptoassets enthusiasts use this application for their trade activities, and they may make donations for this cause.If somehow Telegram do run out of money to sustain themselves they will probably introduce some features that will not hinder the rudimentary principle of Telegram but provide users with enhanced and enriched experience. This could be similar to features where characters can be customized in a game which directly do not affect the in-game strategies but add to the experience.
How to Use Bitcoin?
n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. “They have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. “It’s huge.”