[IronPython] IronPython and polymorphism? Help with interfaces
slide.o.mix at gmail.com
Wed Jan 23 07:42:24 PST 2008
On Jan 23, 2008 8:18 AM, Miha Valencic <miha.valencic at gmail.com> wrote:
> Slide, doesn't work:
> I get. Unhandled Exception:
> IronPython.Runtime.Exceptions.ArgumentTypeException: NoneType object is not
> I passed as IPerson and I even casted to IPerson in IPY.
> The script:
> print IPerson(Env).Name
> produces NoneType object is not callable exception and the script
> print Env.Name
> produces Unhandled Exception: System.MissingMemberException: 'Person' object
> has no attribute 'Name'
> Is there anything else I could try? It seems weird that explicitly defined
> interfaces are not callable. There are probably some even in .NET fx.. I
> even tried:
> IPerson pers = new Person() as IPerson;
> locals["Env"] = pers as IPerson;
> still no go.
> Funny thing is, that dir(IPerson) lists the "Name" attribute (property):
> ['Name', '__class__', '__doc__', '__init__', '__module__', '__repr__']
> On Jan 23, 2008 3:55 PM, Slide <slide.o.mix at gmail.com> wrote:
> > On Jan 23, 2008 6:46 AM, Miha Valencic <miha.valencic at gmail.com> wrote:
> > > Slide, thanks for a quick response. My answers are inline:
> > Person p = new Person();
> > locals["Env"] = p as IPerson;
> Users mailing list
> Users at lists.ironpython.com
I don't have a working IP 1.1 installation right now (I've been
playing with 2.0 A7). I'll install 1.1 and give your code a try.
More information about the Users