(Dino clearly meant this to be a reply to the other thread with respect to C file descriptors. :)
On Mon, Dec 15, 2008 at 1:24 PM, Dino Viehland <di...@microsoft.com> wrote: > Can you open a feature request on CodePlex? It's certainly an interesting > idea to ponder and I'm leaning towards it but there's lots of details to be > gotten right. > > Do you know if this needs to work w/ sockets as well? (There's also the > question of can we make it work with sockets? :)) > > There'll be a bunch of places we need to update (nt, socket, file, select, > etc...) so I think it'll have to wait until 2.1 instead of coming in a minor > update like 2.0.1. > > -----Original Message----- > From: users-boun...@lists.ironpython.com [mailto: > users-boun...@lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, December 15, 2008 1:20 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Determine the classes/interfaces a Python > implements > > > Hi Jeff, > > Probably the easiest way of doing this is to define a Python function > that uses issubtype. You can use this as a delegate from the C# side > (warning untested): > > ScriptScope scope = engine.CreateScope(); > ScriptSource imports = engine.CreateScriptSourceFromString("from System > import ISomething", SourceCodeKind.Staatements); > imports.Execute(scope); > ScriptSource source = engine.CreateScriptSourceFromString("lambda x: > issubtype(x, ISomething)", SourceCodeKind.Expression); > Func<object, bool> Implements = (scope)source.Execute(scope); > > bool result = Implements(some_object); > > > Note that issubtype will barf if you give it anything other than a type, > so it may make more sense to define a function with exception handling > and pull it out of the scope instead. > > HTH > > Michael Foord > > > Jeff Slutter wrote: > > I have a Python script that creates a class within it. This Python class > > is derived off of a class, or interface, I made in C# - something like: > > > > class MyClass(Test.MainForm.IScript): > > ... > > > > Now, back in C#, I have gotten access to "MyClass" by: > > > > object myclass = someScope.GetVariable("MyClass"); > > > > Is there a way to determine either: > > a) what classes/interfaces MyClass implements OR > > b) if it implements a specific class/interface > > > > I want to know if the "object myclass" is supposed to implement > > Test.MainForm.IScript or not. > > > > I don't want to create an instance of MyClass as this would cause > > problems, executing things I'm not ready to execute. > > > > Also, related but not as important, implementing an interface (as above) > > doesn't cause any compiler errors if I'm missing functions - is there a > > way to enforce this? > > > > > > Thanks, > > Jeff > > _______________________________________________ > > Users mailing list > > Users@lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -- > http://www.ironpythoninaction.com/ > http://www.voidspace.org.uk/blog > > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com