yield

    [Python] Iterable and Iterator, plus Generator

    Iterable and Iteartor, and GeneratorIterable for 문에서 in 뒤에 위치하여 iterate (반복, 순회)가 가능한 object를 가르킴.__iter__() 라는 special method를 구현하고 있으며, 이를 통해 자신에 대한 iterator object를 반환할 수 있음.__iter__() special method는보통 iter()함수에 argument로 "iterable instance"가 전달되는 경우해당 argument로 넘겨진 객체(=iterable 객체)의 __iter__() 메서드 가 호출되어 반환되는 iterator 객체가 iter()함수에서 최종 반환됨.여러 데이터를 묶어서 관리하는 Collection들의 object들의 경우, 거의 다 ite..