iterable
iterable1ã¯èªèº«ã®ã¡ã³ãã¼ã1度ã«1ã¤è¿ããããªãã¸ã§ã¯ãã§ãã2ãå
·ä½ä¾ã¯list, str, tuple, dict, file obj, iterãå®è£
ããclassãªã©ãªã©ã
build-iné¢æ°ã®iter()ã«æ¸¡ãã¨iteratorãè¿ãã
iter()é¢æ°ç¸å½ã®æä½ãæ§ã
ãªè¨èªæ©è½ãæ示çã«ãµãã¼ããã¦ãã (e.g. for statement, zip
)
iterator
iterator3ã¯ãã¼ã¿ã¹ããªã¼ã ã表ç¾ãããªãã¸ã§ã¯ãã§ãã4ãnextæä½ã«ããã¹ããªã¼ã ãããã¼ã¿ãåãåºããã¨ãã§ããã
next()ã¡ã½ããã®callãããã¯build-in next()é¢æ°ã¸ã®å¼æ¸¡ãã§ãã¼ã¿ãåãåºããããã¹ããªã¼ã ããã®ååºãã§ãããæ¯æ¸ããå ´åã¯StopIteration
ãæããããï¼ãã以éã¯ä½åº¦callãã¦ãåãï¼ã
iteratorã¯å¿
ç¶çã«ãã¡ã³ãã¼ãè¿ãããªãã¸ã§ã¯ããããªãã¡iterableã§ãããããiter()ã®å®è£
ãå¿
é ã¨ããã¦ããã
ãªãåããã®ã
-> "streamã®è¤æ°åçæ"ãã§ãããã.
streamãçæãã¦ãã¼ã¿ãå°½ããã¾ã§å©ç¨ãã¾ãstreamçæãã¦å©ç¨ããå¯è½.
æ©æ¢°å¦ç¿ã§epochãã¨ã«streamçæããã°å¦ç¿ã«ã¼ãåãã.
-
An object capable of returning its members one at a time. Python - iterable↩
-
“An object representing a stream of data.” Python - iterator ↩