[IronPython] .NET casts in IronPython

Curt Hagenlocher curt at hagenlocher.org
Fri Mar 27 19:26:57 CET 2009


You should be able to do it exactly like that: A.f(x)

On Fri, Mar 27, 2009 at 11:25 AM, Carolyn Johnston (MSNAR) <
carolj at microsoft.com> wrote:

>
> 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
>
> Well, C++ was my first language -- but I am a huge fan of Python and
> IronPython. Since I've dived into the deep end philosophically, I may as
> well push it a bit further.
>
> One of the most useful aspects of IronPython for me is the way that I can
> use IronPython as a loosely typed test environment for .NET classes that
> I've built in C#. Suppose I have a class B which is a subclass of A, which
> both define a function f(x). Suppose I have an object of class B on which
> (for some purely hypothetical reason) I want to run A.f(x) rather than
> B.f(x). This is clearly at the interface of .NET design and Pythonian
> antiObjectian philosophy. Here's my question: is it doable within
> IronPython, or is it not? And if so, how?
>
>
> Thanks,
> :) Carolyn
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090327/a361a5e4/attachment.html>


More information about the Ironpython-users mailing list