Re: [Jython-users] partial imports
by Samuele Pedroni other posts by this author
Feb 27 2002 10:08PM messages near this date
[Jython-users] partial imports
|
Re: [Jython-users] partial imports
Hi.
From: <Matt_Conway@[...].com>
> This might be more of a python question, but here goes anyway. If I
> import a module that has an error in it, the import correctly fails. But
> if I then import the same module again, the import succeeds, and the only
> attributes on that module are those that were processed before the failure
> was hit. Is this correct behavior? It seems very dangerous.
> e.g.
>
> <a.py>
> foo='foo'
> errorhere
> bar='bar'
>
> <interactive>
> >>> import a
> ...NameError...
> >>> import a
> >>> a.foo
> 'foo'
> >>> a.bar
> .. AttributeError...
>
Is the BDFL (Guido van Rossum) intended behavior,
the point is that, if an import fails somehow, you are on your own,
if you know how to cleanup things you can do that explicitly
OTOH the interpreter does not try to illude you to have
properly cleaned up things, because there is no general notion
of what that means ...
the precise rationale is something also Guido continously forget
about.
regards, Samuele Pedroni.
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Samuele Pedroni
Kevin Butler
|