I think you're correct on your understanding of PEP-302, but I only looked at it this morning for the first time :)
Regarding the interfaces, we actually do a lot of this as we use interfaces internally - both for just providing reasonable functionality as well as providing fast paths rather than doing dictionary lookups. If you look at IronPython\Runtime\Interfaces.cs you'll see that we define a bunch of interfaces, the most interesting probably being: IDynamicObject (implements the result of type(xyz)) ISuperDynamicObject (implements xyz.__class__ = 'abc', as well as dictionary access) ICustomAttributes (think override __getattribute__, but w/ setters & getting the dictionary and more) ICodeFormattable (__repr__) IDescriptor (descriptor protocol, __get__) IDataDescriptor (descriptor protocol, __set__, __delete__) IPythonContainer (__len__, __contains__) ISequence (__add__, __mul__, indexing, and __getslice__) IMutableSequence (__delitem__, __setslice__, __delslice__, and writable indexing) IMapping (get, indexing, __delitem__) IRichComparable (__gt__, __lt__, __le__, __ge__, __eq__, __ne__) IRichEquality (IRichComparable but w/o > and <) IWeakReferencable (__weakref__) These are all public APIs currently. They're not exposed via our IronPython.Hosting namespace which is what we think of the core public API surface so there's a chance we could break you in future versions, but most of these are pretty well baked at this point that we don't expect them to change. Unfortunately I don't think we have much more guidance on using these then that & the documentation in the file. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nathan R. Ernst Sent: Wednesday, July 05, 2006 3:49 PM To: 'Discussion of IronPython' Subject: Re: [IronPython] Importing embedded .py files PEP-302 definitely sounds like what I had in mind (but wasn't quite so eloquently able to put into writing). Dino, et. al., please correct me if I'm wrong, but a PEP-302 based solution to the original problem would involve the installation of an object into sys.path_hooks that would return an importer item capable of loading the specified module from a resource? Reading through the PEP sparked another random thought: Might it be of use to IronPython developers to have .Net consumable interfaces defined for some of the more common Python protocols? While I admit this would likely be of little functional value, it could lend a good deal of declarative value, especially when implementing objects in .Net that intended to be consumed directly by IronPython. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dino Viehland Sent: Wednesday, July 05, 2006 11:29 AM To: Discussion of IronPython Subject: Re: [IronPython] Importing embedded .py files I've opened a bug on CodePlex (bug 775 http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId =775) to implement PEP-302 which seems to be the new version of ihooks (it says no one was satisfied w/ ihooks). I've opened it as a post-1.0 bug. _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
