On Fri, Feb 8, 2013 at 5:49 PM, Rick Johnson <rantingrickjohn...@gmail.com> wrote: > On Friday, February 8, 2013 6:05:54 PM UTC-6, Chris Angelico wrote: >> The sum builtin works happily on any sequence of objects >> that can be added together. It works as an excellent >> flatten() method: >> >> >>> nested_list = [["q"], ["w","e"], ["r","t","u"], ["i","o","p"]] >> >>> sum(nested_list,[]) >> ['q', 'w', 'e', 'r', 't', 'u', 'i', 'o', 'p'] >> >>> nested_list >> [['q'], ['w', 'e'], ['r', 't', 'u'], ['i', 'o', 'p']] > > What the hell? Oh yeah, you must be using pike again. No, if it were pike the > list would look like this: > > ({({"q"}), ({"w","e"}), ({"r","t","u"}), ({"i","o","p"})}) > > Of course you'd have to declare it first using an /expanded/ Java syntax: > > nested_list = array(array(string)) > > Folks, i couldn't make this stuff up if i wanted to. Go read for yourself if > want a few laughs.
Classic ad hominem. Try to make your opponent look bad by making fun of them on a completely unrelated topic, and then hope that nobody notices that you entirely ignored the substance of their argument. Sorry, it didn't work. You didn't even do a good job of it. Yes, Pike uses two characters instead of one to wrap array literals. Big friggin' whoop. On the minus side, it's a little more typing. On the plus side, they stand out better, and you don't have the [] characters doing double duty denoting list literals and indexing alike. Yes, Pike writes **string as the more readable array(array(string)) -- although if my memory serves correctly the former is also legal syntax. Again, nobody cares. And by the by, Pike is a descendant of C, not Java. Its predecessor LPC predates Java by about 6 years. If you're going to start lambasting others' preferred programming languages in an effort to make yourself look good, you can at least get your facts straight. -- http://mail.python.org/mailman/listinfo/python-list