[IronPython] Improvements to the hosting APIs
Dino Viehland
dinov at microsoft.com
Fri Feb 12 22:39:25 CET 2010
Jeff wrote:
> On Fri, Feb 12, 2010 at 1:47 PM, Dino Viehland <dinov at microsoft.com> wrote:
> >
> > Jeff wrote:
> >> * A version of PythonOps.MakeException that doesn't take a code
> >> context - It's not hard to create one, but every time I do I feel like
> >> I'm doing something wrong.
> >> * An easy way to wrap a Stream as a PythonFile.
> >
> > I'm guessing you also want the Stream->PythonFile to not take a CodeContext?
>
> Yep. Ideally IMO I should never see one when hosting IronPython.
>
> >
> > Do you think an extension method on Stream would be nice - such as
> > stream.ToPythonFile(string filename, string mode)?
>
> Yeah, actually - I didn't mention it because I didn't think it would
> be possible (I thought you might need some context from the engine),
> but that might even be better. Maybe an overload (ToPythonFile()) that
> just makes up a filename/mode as well, for when it doesn't matter. My
> only concern with extension methods is that they're just not very
> discoverable.
I'd plan to continuing to put our extension methods on the Python class
So you'd also be able to do Python.ToPythonFile(stream, ...). My big problem
w/ extension methods is they're verbose to explain how to use (just call
.ToPythonFile! Oh, you don't have the namespace included...?)
I agree you should never see a CodeContext especially given that they break
the remoting story.
More information about the Ironpython-users
mailing list