[IronPython] Improvements to the hosting APIs

Jeff Hardy jdhardy at gmail.com
Fri Feb 12 22:22:03 CET 2010


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.

- Jeff



More information about the Ironpython-users mailing list