I am also not here to criticize style here, but I want to point
something out.

Something like a[1,2] might look wrong, but it's actually parsed
specially by Python to accommodate slicing of multidimensional arrays.
The difference is that, inside [], you can use slicing syntax, as in
a[1:2,3:4].  But using parentheses forces it to be parsed as an
ordinary tuple, where you can't use slicing syntax.  Thus, a[(1:2,3:4)]
is a syntax error.

Obviously this is irrelevant for dicts.  But if you're using some sort
of custom array object, that supports slicing in multiple dimensions,
you can't slice with the parentheses. Because of this, I don't use the
parentheses for things like multidimensional arrays.

I tend to use the parentheses whenever the index is some sort of atomic
value, however.

-- 
CARL BANKS

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to