.  GoF  Python, C++23, Rust  Java
 


       ,  ,    .  ,            .  GoF    , ,    ,     Python, C++23, Rust  Java.         .





.  GoF  Python, C++23, Rust  Java








       (Iterator).       (Gang of Four, GoF).       :  Python, C++23, Rust  Java.      :     ,  , ,     .




 


     :        .     ,    1.2      ,   .




 16.   Python





16.1.   


   , , ,       API.     :    ,  ,   .  ,            .

       .         .    .

 Python     ,    .  for, , list(), sum(),        :

   __iter__,  ;

  __next__,      StopIteration,  __iter__,  .

 (yield)      ,   itertools    -.




16.2.   











Iterator  ,  .

Concrete Iterator    .

Iterable (Aggregate)  .




16.3.  : 


 01_playlist.py:










 16.1  : 










 16.1 ()  : 

. :   iter(pl)      ,   a  b .  :       .        .          .




  .


   .

   ,     (https://www.litres.ru/book/aleksey-primak/iterator-pattern-gof-na-python-c-23-rust-i-java-74810722/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


