bearophile Wrote: > I'd really like the "default" iteration on an AA to yield its keys, instead > of values as currently done. Because if I have a key I can find its value, > while the opposite is not possible, so having keys is much more useful. This > is true in Python too. In my dlibs all iterables and functions behave like > this. The current D design is just a design mistake ad Walter was wrong on > this. >
No! No! No! Maybe you are wrong. Or it's a metter of taste. I remember that I spent many hours on finding bug in python's script written by me in my job. The reason was the python's behaviour decribed by you. Then I couldn't understand why the hell iterating on collection returns a key in the first place. It's so not intuitive. Your explanation is not even close in convincing me. If I wanted keys I would write: foreach (key, value; set) or (key; set.keys) Now I know why I don't like Python and I hope I will never have to need it again. For scriptng (but not at work since I don't do scripting enymore) I prefer D (rdmd). bearophile, I like your great commitment in D development but I don't like pushing D toward pythonish world. (Of course some ideas from Python project could be succesfully used in D) Cheers Piotrek
