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
I have no inside knowledge of a potential stock listing of the popular anti-Whatsapp messaging app, Telegram. But I know this much, judging by most people I talk to, especially crypto investors, if Telegram ever went public, people would gobble it up. I know I would. I’m waiting for it. So is Sergei Sergienko, who claims he owns $800,000 of Telegram’s pre-initial coin offering (ICO) tokens. “If Telegram does a SPAC IPO, there would be demand for this issue. It would probably outstrip the interest we saw during the ICO. Why? Because as of right now Telegram looks like a liberal application that can accept anyone - right after WhatsApp and others have turn on the censorship,” he says.
What Is Bitcoin?
Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.