[Ironruby-core] [IronPython] Telling .NET classes from Python objects

Tomas Matousek Tomas.Matousek at microsoft.com
Tue Apr 28 14:45:15 EDT 2009


I would recommend not to rely on whether an object is Ruby object or .NET object if possible. You might be surprised to get a COM object, a Python object, DLR expand, etc. if you do so. Use rather respond_to?, include? to ask for specific methods/protocols.

Tomas

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Michael Letterle
Sent: Tuesday, April 28, 2009 11:10 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] [IronPython] Telling .NET classes from Python objects

Class#to_clr_type? Returns nil for custom Ruby objects... depends on
what you're looking for...

On Tue, Apr 28, 2009 at 1:38 PM, Ivan Porto Carrero <ivan at flanders.co.nz> wrote:
> +1 for this question only I need it to implement different binding
> strategies in IronMVC.
>
> IronRuby in Action (http://manning.com/carrero)
>
> Winston Churchill  - "The best argument against democracy is a five-minute
> conversation with the average voter."
>
> On Tue, Apr 28, 2009 at 7:35 PM, Michael Foord <fuzzyman at voidspace.org.uk>
> wrote:
>>
>> Hello guys,
>>
>> I'm continuing my work on generating pi files for the Wing IDE. Actually
>> everything I encounter will be a .NET type, but in general what is the best
>> way of telling if an object is a .NET type or a Python type?
>>
>> Obviously for the primitives it is a moot point - but I'm talking about
>> user defined classes.
>>
>> Michael
>>
>> --
>> http://www.ironpythoninaction.com/
>> http://www.voidspace.org.uk/blog
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>



-- 
Michael Letterle
IronRuby MVP
http://blog.prokrams.com
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list