On Sun, 16 Aug 2009 09:24:36 +0200, Hendrik van Rooyen wrote: >>"Steven D'Aprano" <st...@remove-this-c...e.com.au> wrote: > >>Now that I understand what the semantics of cout << "Hello world" are, I >>don't have any problem with it either. It is a bit weird, "Hello world" >>>> cout would probably be better, but it's hardly the strangest design >>>> in >>any programming language, and it's probably influenced by input >>redirection using < in various shells. > > I find it strange that you would prefer: > > "Hello world" >> cout > over: > cout << "Hello world" > > The latter seems to me to be more in line with normal assignment: - Take > what is on the right and make the left the same.
I don't like normal assignment. After nearly four decades of mathematics and programming, I'm used to it, but I don't think it is especially good. It confuses beginners to programming: they get one set of behaviour drilled into them in maths class, and then in programming class we use the same notation for something which is almost, but not quite, the same. Consider the difference between: y = 3 + x x = z as a pair of mathematics expressions versus as a pair of assignments. What conclusion can you draw about y and z? Even though it looks funny due to unfamiliarity, I'd love to see the results of a teaching language that used notation like: 3 + x -> y len(alist) -> n Widget(1, 2, 3).magic -> obj etc. for assignment. My prediction is that it would be easier to learn, and just as good for experienced coders. The only downside (apart from unfamiliarity) is that it would be a little bit harder to find the definition of a variable by visually skimming lines of code: your eyes have to zig-zag back and forth to find the end of the line, instead of running straight down the left margin looking for "myvar = ...". But it should be easy enough to search for "-> myvar". > I suppose it is because > we read from left to right that the first one seems better to you. Probably. -- Steven -- http://mail.python.org/mailman/listinfo/python-list