[Numpy-discussion] why type(array(1).tolist()) is int?
Wed Oct 1 08:57:26 CDT 2008
Alan G Isaac wrote:
> On 10/1/2008 9:04 AM dmitrey apparently wrote:
>> why array(1).tolist() returns 1? I expected to get  instead.
> I guess I would expect it not to work at all.
> Given that it does work, this seems the best result.
> What list shape matches the shape of a 0-d array?
> What is the use case that makes this seem wrong?
Because I just expect something.tolist() return *Type* list, not *Type*
integer. tolist documentation says "Return the array as a list or
nested lists" and nothing about possibility to return anything else.
As for my situation I store the list in my data field and then call
for item from prob.my_list: do_something()
> Alan Isaac
> Numpy-discussion mailing list
More information about the Numpy-discussion