[IronPython] .NET casts in IronPython

Tim Roberts timr at probo.com
Fri Mar 27 18:33:15 CET 2009

On Thu, 26 Mar 2009 15:49:27 -0700, "Carolyn Johnston (MSNAR)"
<carolj at microsoft.com>
> You are right, I didn't need to do the cast - was just transcribing some C# code that did that for some reason.
> However, it is still a good question (instead of upcasting, think of downcasting), and the answer isn't out there that I could find.

You are trying to apply C++ and C# thinking to Python.  This is a
fundamental philosophical difference between the languages.  Python
doesn't care what the object IS.  Python only cares what it EXPOSES.  If
it has a GetName() method, you can call it, no matter what the object
ancestry was.

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the Ironpython-users mailing list