Re: [IronPython] Distinguishing DLR object from CLR object

2008-01-30 Thread Curt Hagenlocher
On Jan 30, 2008 3:31 PM, Dino Viehland <[EMAIL PROTECTED]> wrote:
>
> If by "DLR object" you mean an object which has dynamic behavior beyond just
> it's type you can check to see if it implements IDynamicObject.  But there
> really isn't anything considered to be a "DLR object".

Yes. I wasn't very happy with the categorization, but couldn't think
of a better way to express what I meant.  Your answer was exactly what
I wanted:

clr.GetClrType(Microsoft.Scripting.IDynamicObject).IsAssignableFrom(type(obj))

--
Curt Hagenlocher
[EMAIL PROTECTED]
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Distinguishing DLR object from CLR object

2008-01-30 Thread Dino Viehland
If by "DLR object" you mean an object which has dynamic behavior beyond just 
it's type you can check to see if it implements IDynamicObject.  But there 
really isn't anything considered to be a "DLR object".  They're all just CLR 
objects and some of them can have dynamic behavior.  Even normal CLR objects 
could have behaviors beyond just their normal CLR type - for example the 
various methods we add onto .NET strings that match the Python built-in string 
members.  But I think IDynamicObject will probably get you the answer you're 
looking for.


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Curt Hagenlocher [EMAIL 
PROTECTED]
Sent: Wednesday, January 30, 2008 3:15 PM
To: Discussion of IronPython
Subject: [IronPython] Distinguishing DLR object from CLR object

Is there a straightforward and reliable way from within IronPython to tell if a 
particular object is a "CLR object' or a "DLR object"?  I can make a guess for 
just IronPython by saying

isPythonObject = clr.GetClrType(type(obj)).FullName.startswith('IronPython')

but this is both ugly and unreliable.

--
Curt Hagenlocher
[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Distinguishing DLR object from CLR object

2008-01-30 Thread Curt Hagenlocher
Is there a straightforward and reliable way from within IronPython to tell
if a particular object is a "CLR object' or a "DLR object"?  I can make a
guess for just IronPython by saying

isPythonObject = clr.GetClrType(type(obj)).FullName.startswith('IronPython')

but this is both ugly and unreliable.

--
Curt Hagenlocher
[EMAIL PROTECTED]
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com