... think ... including ... I seem to be perennially defending disfavored Python proposals, but here goes. I was quite relieved to see Guido's proposed colon...
n8spam@...
Mar 3, 2001 3:29 am
60
Hello. I am very new to python and find this discussion interesting as "iterators and generic functions" were the first thing that I marked as notably absent....
Clark C. Evans
cce@...
Mar 3, 2001 5:03 am
61
Another question, have people considerd "tuple" syntax? I actually find this more readable than colon syntax. for (key,_) in dict: for (_,value) in dict: for...
Clark C. Evans
cce@...
Mar 3, 2001 5:07 am
62
... for k in dict.keys(): for k,v in dict.items(): but with something more appropriate (using some lazy iteration protocol) instead of keys and items....
qrczak@...
Mar 3, 2001 9:36 am
63
From: <qrczak@...> ... Requires diferent evaluation of dict.keys() in diferent context. Maybe it was motivation for colon sintax, reserved for...
gzeljko
gzeljko@...
Mar 3, 2001 10:24 am
64
... Huh? That's exactly what was originally proposed in the PEP. Any callable object can serve as an iterator, since it is called to produce the next item....
Ka-Ping Yee
ping@...
Mar 3, 2001 10:43 am
65
From: Ka-Ping Yee <ping@...> ... Is this going to be supported in for-loop ? for target_list in expression_list: x = eval(expression_list) while 1: if...
gzeljko
gzeljko@...
Mar 3, 2001 11:26 am
66
... It does not. It would always be a lazy list, which provides both a sequence protocol and an iteration protocol. The iteration protocol could just reuse...
qrczak@...
Mar 3, 2001 11:59 am
67
... Here is a backward compatible proposal. The meaning of 'for x in seq: statement' is as follows: try: _tmp = seq.__iterator__() except AttributeError: _tmp...
qrczak@...
Mar 3, 2001 12:32 pm
68
... I can see that this would work, but i don't understand why you prefer while 1: body(iter[0]) iter = iter[1:] to while 1: # when a...
Ka-Ping Yee
ping@...
Mar 3, 2001 12:42 pm
69
... Binding to tuples already has a well-defined meaning. blah = [(1, 2), (3, 4), (5, 6)] for (a, b) in blah: makes perfect sense, analogous to (a, b) = (1, 2)...
Ka-Ping Yee
ping@...
Mar 3, 2001 12:45 pm
70
From: <qrczak@...> ... a=some_dict.keys() # a going to be 'list' In others words, they 'must' implement complete list interface, 1. without own...
gzeljko
gzeljko@...
Mar 3, 2001 1:14 pm
71
... The former uses an already existing interface. The latter is a new interface. The former doesn't mutate the iterator. Because of this a sequence itself can...
qrczak@...
Mar 3, 2001 2:21 pm
72
From: <qrczak@...> ... You can think about that in your own terms :) so: dict.keys = stateless lazy list dict.keys() = dict.keys.__call__() - to produce...
gzeljko
gzeljko@...
Mar 3, 2001 4:10 pm
73
... Oops. How quickly we forget. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)...
Guido van Rossum
guido@...
Mar 3, 2001 4:14 pm
74
From: Guido van Rossum <guido@...> ... Thanks. There was some indications :) ly-y'rs-gzeljko...
gzeljko
gzeljko@...
Mar 3, 2001 5:05 pm
75
... I think comments similar to this have been made a few times now about the colon syntax for mapping iteration -- to paraphrase, "Why bother with the colons...
Ka-Ping Yee
ping@...
Mar 4, 2001 1:56 am
76
Hi, everyone. I thank you all for your participation and for contributing your ideas on the issues surrounding iterators. I'm collecting some of the points...
Ka-Ping Yee
ping@...
Mar 4, 2001 1:56 am
77
Just a note to remind those of you who are coming to the Python 9 conference in Long Beach: there will be a "birds-of-a-feather" (BOF) meeting about iterators...
Ka-Ping Yee
ping@...
Mar 4, 2001 2:21 am
78
... It would be generally nice to be able to 'skip' items occuring within a tuple. Thus, the answer could be: for (key,) in spam: This is better since it is...
Clark C. Evans
cce@...
Mar 4, 2001 3:56 pm
79
... This syntax is ambiguous because this is unpacking of a 1-tuple. I wonder if the interpreter is allowed to optimize by translation of key,_ = spam to a...
qrczak@...
Mar 4, 2001 6:27 pm
80
... Wouldn't it be an error if it was anything but a two-tuple (or dictionary entry)? ;) Clark...
Clark C. Evans
cce@...
Mar 4, 2001 6:30 pm
81
... [(1, 2, 3), (4, 5, 6)] ... ... Traceback (innermost last): File "<interactive input>", line 1, in ? ValueError: unpack tuple of wrong size I don't...
Clark C. Evans
cce@...
Mar 4, 2001 6:32 pm
82
gzeljko wrote: ... NOT TRUE! People didn't complain (much) for the first 15 years because they didn't know any better! The instant that I discovered perl...
Michael Chermside
mcherm@...
Mar 6, 2001 12:18 am
83
From: Michael Chermside <mcherm@...> ... Don't take it so strict :) ... If one use strings for strings, End-s for End-s ... ... Never think there are...
Zoka
gzeljko@...
Mar 6, 2001 3:37 am
84
Hi all, I believe Guido has pretty much made up his mind on the subject of iterators and i wanted to inform you of the current plan. Here is my understanding...
Ka-Ping Yee
ping@...
Mar 11, 2001 10:00 am
85
... I like it. Does it mean that there will be methods like xkeys and xitems which produce iterators instead of sequences? -- __("< Marcin Kowalczyk *...
qrczak@...
Mar 11, 2001 10:53 am
86
... Was there resolution on dictionaries? In particular, was the implicit tuple unpacking mechanism I described earlier considered as part of this solution. ...
Clark C. Evans
cce@...
Mar 11, 2001 10:56 am
87
... No. The issue of dictionary iteration was left separate (perhaps for a future PEP). Whether, and how, we would provide iterators on dictionaries and...
Ka-Ping Yee
ping@...
Mar 11, 2001 11:02 am
88
... You can't have this syntax, because it already means a different thing: unpacking 1-tuples. IMHO having explicit dictionary methods like xkeys and xitems...