[IronPython] Generics support in IronPython

Jim Hugunin jimhug at microsoft.com
Thu Apr 7 01:54:29 CEST 2005


The declaration of Python classes with generic type parameters is not supported today, and is not currently on my todo list for 1.0.  I see generic types as vitally important in static languages like C#, but much less important for dynamic languages like Python.  It's important for IronPython to be able to use these types, and even create new concrete instances like shown below, to interoperate as well as possible with .NET libraries.  If I saw a strong case for why Python programmers should want to create new generic types then we might look into this sooner.

-Jim

________________________________________
From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer
Sent: Friday, April 01, 2005 6:39 PM
To: Discussion of IronPython
Subject: RE: [IronPython] Generics support in IronPython

So that shows consumption -- is creation supported?
 
Very cool

________________________________________
From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Jim Hugunin
Sent: Fri 4/1/2005 5:17 PM
To: Martin Smith; users-ironpython.com at lists.ironpython.com
Subject: RE: [IronPython] Generics support in IronPython
Martin Smith wrote:
> Will IronPython support generics?

Here's the short answer to your question:

>>> from System.Collections.Generic import *
>>> l = List[str]()
>>> l.Add('hi')
>>> list(l)
['hi']
>>> l.Add(42)
System.Exception: bad args to this method <method# Add on
<snip>



More information about the Ironpython-users mailing list