Questions tagged «iterator»

30
“අස්වැන්න” මූල පදය කරන්නේ කුමක්ද?
yieldපයිතන් හි යතුරු පදයේ භාවිතය කුමක්ද, එය කරන්නේ කුමක්ද? උදාහරණයක් ලෙස, මම මෙම කේතය 1 තේරුම් ගැනීමට උත්සාහ කරමි : def _get_child_candidates(self, distance, min_dist, max_dist): if self._leftchild and distance - max_dist < self._median: yield self._leftchild if self._rightchild and distance + max_dist >= self._median: yield self._rightchild අමතන්නා මෙයයි: result, candidates = …

7
සමාන්තරව ලැයිස්තු දෙකක් හරහා නැවත ක්‍රියා කරන්නේ කෙසේද?
මට පයිතන්හි පුනරාවර්තන දෙකක් තිබේ, මට ඒවා යුගල වශයෙන් යාමට අවශ්‍යයි: foo = (1, 2, 3) bar = (4, 5, 6) for (f, b) in some_iterator(foo, bar): print "f: ", f, "; b: ", b එහි ප්‍රති result ලය විය යුත්තේ: f: 1; b: 4 f: 2; b: 5 f: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.