Re: [IronPython] .NET casts in IronPython

2009-03-27 Thread Michael Foord
xt group Bldg 109/4053 | MIcrosoft Corporation 425-706-2153 -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, March 27, 2009 11:29 AM To: Discussion of IronPython Subject: Re: [IronPython] .NET casts in

Re: [IronPython] .NET casts in IronPython

2009-03-27 Thread Carolyn Johnston (MSNAR)
ts.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, March 27, 2009 11:29 AM To: Discussion of IronPython Subject: Re: [IronPython] .NET casts in IronPython Carolyn Johnston (MSNAR) wrote: > You are trying to apply C++ and C# thinking to Python. T

Re: [IronPython] .NET casts in IronPython

2009-03-27 Thread Michael Foord
Carolyn Johnston (MSNAR) 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

Re: [IronPython] .NET casts in IronPython

2009-03-27 Thread Curt Hagenlocher
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) < car...@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 car

Re: [IronPython] .NET casts in IronPython

2009-03-27 Thread Carolyn Johnston (MSNAR)
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

Re: [IronPython] .NET casts in IronPython

2009-03-27 Thread Tim Roberts
On Thu, 26 Mar 2009 15:49:27 -0700, "Carolyn Johnston (MSNAR)" > 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 the

Re: [IronPython] .NET casts in IronPython

2009-03-26 Thread Curt Hagenlocher
rporation > 425-706-2153 > > > > *From:* users-boun...@lists.ironpython.com [mailto: > users-boun...@lists.ironpython.com] *On Behalf Of *Dino Viehland > *Sent:* Thursday, March 26, 2009 1:59 PM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] .NET casts in Iro

Re: [IronPython] .NET casts in IronPython

2009-03-26 Thread Carolyn Johnston (MSNAR)
IronPython] .NET casts in IronPython Why do you need to cast to the base class? All of the members you need should already be there. From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Carolyn Johnston (MSNAR) Sent: Thursday, March 26, 2009 3:47 PM

Re: [IronPython] .NET casts in IronPython

2009-03-26 Thread Dino Viehland
Subject: [IronPython] .NET casts in IronPython I need to cast a .NET object A to a .NET object B. There is nothing tricky about the cast, it's a straightforward cast to a base type. How can I do this in IP? Thanks! :) Carolyn Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research

[IronPython] .NET casts in IronPython

2009-03-26 Thread Carolyn Johnston (MSNAR)
I need to cast a .NET object A to a .NET object B. There is nothing tricky about the cast, it's a straightforward cast to a base type. How can I do this in IP? Thanks! :) Carolyn Carolyn Johnston (carolj) Lead Researcher, MSN Applied Research Text group Bldg 109/4053 | MIcrosoft Corporation 425