[IronPython] List<Python Class>

Matthew Barnard m.stephen.barnard at gmail.com
Sat May 3 06:58:41 CEST 2008


Thanks Curt, in C# I use generics (list & dict) containing class instances
quite often. Is there a caveat to the dynamic typing that I'm missing?


On Fri, May 2, 2008 at 7:52 PM, Curt Hagenlocher <curt at hagenlocher.org>
wrote:

> This will get you a CLR type directly from your class object:
>
> class foo(object):
>     pass
> theType = clr.GetClrType(foo)
>
> What use do you have for creating a generic with the resulting
> (dynamically-generated) type?
>
> On Fri, May 2, 2008 at 6:30 PM, Matthew Barnard <
> m.stephen.barnard at gmail.com> wrote:
>
> > Is the following the only way to create a generic containing a python
> > class?
> >
> >
> > from System.Collections.Generic import List
> > from System import Type
> >
> > class Foo:
> >     >>class stuff<<
> >
> > l = List[Type.GetType(Foo())]()
> >
> >
> > I assume this is the nature of dynamic typing, but is there a way to get
> > the type from the classobj, and not an instance?
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>


-- 
___________________________
Matthew Barnard
602 540 0652
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080502/2e4167c1/attachment.html>


More information about the Ironpython-users mailing list