On Tue, Nov 8, 2011 at 4:09 PM, Lie Ryan <lie.1...@gmail.com> wrote: > IMO, Python has a much nicer choice of built-in data structure for data > processing. Python has a much more mature object-orientation, e.g. I prefer > writing l.append(x) rather than array_push(l, x). I think these qualities > are what makes you think Python is much, much more suitable for data > processing than PHP; and I wholesomely agree. >
Two more examples where Python's lists are superior to PHP's arrays. Array literal syntax feels like a function call, but list literals are slim and easy to use inside expressions (try creating a nested array as a function argument - you'll get a forest of parens). Also, dereferencing an array only works on an array variable - if you have a function that returns an array, you can't dereference it directly: $foo = func()[1]; # doesn't work $foo = func(); $foo=$foo[1]; # works I much prefer the "everything's an object" notion. C's array literals are just as weird (although in C, you can directly dereference a literal character array - "ABCDEFG"[note_idx] will give you a note name as a char)... much easier when a variable name is just an expression, a function call is an expression, a literal is an expression, and you can work with them all the same way. ChrisA -- http://mail.python.org/mailman/listinfo/python-list