ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Jython-users
Jython-users
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved