On Friday, February 8, 2013 7:17:26 PM UTC-6, Chris Angelico wrote: > On Sat, Feb 9, 2013 at 11:49 AM, Rick Johnson > > nested_list = array(array(string)) > > Actually, that's not a declaration, that's an assignment; and in Pike, > a 'type' is a thing, same as it is in Python (though not quite). If I > were to declare it in Pike, it would be: > > array(array(string)) nested_list; > > Though the part inside the parens can be omitted, in which case the > array can contain anything, rather than being restricted to strings. > In actual fact, Rick, despite your complaints about the syntax, it's > able to achieve exactly what you were thinking Python should do: > declare an array/list that contains only numbers.
Well Chris i have wonderful news for you! Python /does/ have "homogenous arrays", and they're called, wait for it......... arrays! Imagine that! py> import array py> intSeq = array.array('i') py> intSeq.append(1) py> intSeq.append(2) py> intSeq.append(5000) py> intSeq.append(5000.333) TypeError: integer argument expected, got float py> intSeq.append('5000.333') TypeError: an integer is required -- http://mail.python.org/mailman/listinfo/python-list