Newbie question - array module/fromlist method
jepler at unpythonic.net
Thu Feb 20 20:39:22 CET 2003
fromlist is a method of an array object, not a function of the array
>>> import array
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'fromlist'
<built-in method fromlist of array.array object at 0x40063218>
If fromlist() was a function, or a class/static method, it would have no
way to know what type of array to create and return. by saying
you can get an array of the desired numeric type.
>>> array.fromlist('i', l)
might make a nice shorthand for this.
More information about the Python-list