[IronPython] Type of an empty array

Dino Viehland dinov at exchange.microsoft.com
Wed Aug 30 17:35:48 CEST 2006

Wow, it's actually a little bit worse than what you describe - if we get a step != 1 we also return an object array:

import System
a = System.Array[int]( range(10) )
print a[1:9:2]

prints System.Object[](1, 3, 5, 7)

I've opened CodePlex bug #2730 for this (http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=2730).  The issue here is we have one code path that creates the strongly typed array, and another that always creates object arrays.  I'm marking this as a 1.01 bug for the time being.

Thanks for the bug report!

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Tuesday, August 29, 2006 11:06 PM
To: Discussion of IronPython
Subject: [IronPython] Type of an empty array

Slicing an array to an empty array seems to lose type information.
(This is a corner case and not urgent or blocking.)

>>> from System import Array
>>> empty = Array[int]([])
>>> type(empty)
<type 'Array[int]'>
>>> one = Array[int]([0])
>>> type(one)
<type 'Array[int]'>
>>> type(one[:1])
<type 'Array[int]'>
>>> type(one[:0])
<type 'Array[object]'>

Seo Sanghyeon
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list