2010/4/20 Přikryl Petr <prik...@atlas.cz>: > def __iter__(self): > '''Vraci iterator -- sam sobe iteratorem.''' > self.idx = 0 > return self
prosim takto ne, kdyz udelam it = iter(slova) it2 = iter(slova) tak ty iteratory se navzajem ovlivnuji. Problem ale stejne bude v tom, ze kdyz chci prvy, druhy, treti, ctrty = slova tak ten iterator musi vratit presne 4 hodnoty a pak vyvolat StopIteration. A jak tomu reknes, ze z toho tahas ty 4 hodnoty? Leda tak tim, ze tam fakt budou presne 4. To ale neni chovani, ktere ocekava tazatel. viz http://docs.python.org/reference/simple_stmts.html#assignment-statements - "If the target list is a comma-separated list of targets: The object must be an iterable with the same number of items as there are targets in the target list," PM _______________________________________________ Python mailing list Python@py.cz http://www.py.cz/mailman/listinfo/python