[IronPython] imports & .NET classes...

Dan Eloff dan.eloff at gmail.com
Sun Jul 27 18:24:08 CEST 2008

On Fri, Jul 25, 2008 at 6:39 PM, Dino Viehland
<dinov at exchange.microsoft.com> wrote:
> To enable a better story w/ .NET we would like
> to enable from System.DateTime import Parse – supporting the import of
> static functions.

That seems reasonable, and it's consistent with being able to import
static functions from static classes, which I like.

>  But the interesting question then becomes should we allow
> from System.DateTime import Now – a static property?

Yes. To be honest I'd rather see this either disallowed altogether, or
to function as it does currently. If you import a static property,
it's like treating it as a module scoped variable in python, so it
should behave like one, giving you the value of the property at import
time. This means importing Now would make no sense unless you want the
time at import. However, think if MaxValue was implemented as a static
property. Treating it as a module scoped variable makes sense.

  Finally, should we
> allow from System.DateTime import AddMonths – an instance method?

No. There is no precedent for that, it would be unexpected behavior.


More information about the Ironpython-users mailing list