... think ... including ... I seem to be perennially defending disfavored Python proposals, but here goes. I was quite relieved to see Guido's proposed colon...
60
Clark C. Evans
cce@...
Mar 3, 2001 5:03 am
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....
61
Clark C. Evans
cce@...
Mar 3, 2001 5:07 am
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...
62
qrczak@...
Mar 3, 2001 9:36 am
... 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....
63
gzeljko
gzeljko@...
Mar 3, 2001 10:24 am
From: <qrczak@...> ... Requires diferent evaluation of dict.keys() in diferent context. Maybe it was motivation for colon sintax, reserved for...
64
Ka-Ping Yee
ping@...
Mar 3, 2001 10:43 am
... 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....
65
gzeljko
gzeljko@...
Mar 3, 2001 11:26 am
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...
66
qrczak@...
Mar 3, 2001 11:59 am
... 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...
67
qrczak@...
Mar 3, 2001 12:32 pm
... Here is a backward compatible proposal. The meaning of 'for x in seq: statement' is as follows: try: _tmp = seq.__iterator__() except AttributeError: _tmp...
68
Ka-Ping Yee
ping@...
Mar 3, 2001 12:42 pm
... 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...
69
Ka-Ping Yee
ping@...
Mar 3, 2001 12:45 pm
... 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)...
70
gzeljko
gzeljko@...
Mar 3, 2001 1:14 pm
From: <qrczak@...> ... a=some_dict.keys() # a going to be 'list' In others words, they 'must' implement complete list interface, 1. without own...
71
qrczak@...
Mar 3, 2001 2:21 pm
... 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...
72
gzeljko
gzeljko@...
Mar 3, 2001 4:10 pm
From: <qrczak@...> ... You can think about that in your own terms :) so: dict.keys = stateless lazy list dict.keys() = dict.keys.__call__() - to produce...
73
Guido van Rossum
guido@...
Mar 3, 2001 4:14 pm
... Oops. How quickly we forget. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)...
74
gzeljko
gzeljko@...
Mar 3, 2001 5:05 pm
From: Guido van Rossum <guido@...> ... Thanks. There was some indications :) ly-y'rs-gzeljko...
75
Ka-Ping Yee
ping@...
Mar 4, 2001 1:56 am
... 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...
76
Ka-Ping Yee
ping@...
Mar 4, 2001 1:56 am
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...
77
Ka-Ping Yee
ping@...
Mar 4, 2001 2:21 am
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...
78
Clark C. Evans
cce@...
Mar 4, 2001 3:56 pm
... 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...
79
qrczak@...
Mar 4, 2001 6:27 pm
... 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...
80
Clark C. Evans
cce@...
Mar 4, 2001 6:30 pm
... Wouldn't it be an error if it was anything but a two-tuple (or dictionary entry)? ;) Clark...
81
Clark C. Evans
cce@...
Mar 4, 2001 6:32 pm
... [(1, 2, 3), (4, 5, 6)] ... ... Traceback (innermost last): File "<interactive input>", line 1, in ? ValueError: unpack tuple of wrong size I don't...
82
Michael Chermside
mcherm@...
Mar 6, 2001 12:18 am
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...
83
Zoka
gzeljko@...
Mar 6, 2001 3:37 am
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...
84
Ka-Ping Yee
ping@...
Mar 11, 2001 10:00 am
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...
85
qrczak@...
Mar 11, 2001 10:53 am
... I like it. Does it mean that there will be methods like xkeys and xitems which produce iterators instead of sequences? -- __("< Marcin Kowalczyk *...
86
Clark C. Evans
cce@...
Mar 11, 2001 10:56 am
... Was there resolution on dictionaries? In particular, was the implicit tuple unpacking mechanism I described earlier considered as part of this solution. ...
87
Ka-Ping Yee
ping@...
Mar 11, 2001 11:02 am
... No. The issue of dictionary iteration was left separate (perhaps for a future PEP). Whether, and how, we would provide iterators on dictionaries and...
88
qrczak@...
Mar 11, 2001 12:00 pm
... 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...