News for hackers. Stuff that matters.
Re:Common Python Mistakes by cridenour on Thursday May 08, 2014 @11:49AM (#7715922)
For #7, now you have a performance problem of importing every time you run that function. Rather, you can place the import at the bottom of b.py and be okay.
Re:Common Python Mistakes by mguillech on Thursday May 08, 2014 @12:33PM (#7716158)
Python caches modules imported, you can check it out in your local shell with: import sys ; sys.modules. That's why whenever you make changes to a module which has been already loaded you won't see the changes until you load the module again, either quitting the shell or using reload(module) on Python 2.x
Re:Common Python Mistakes by jagger27 on Thursday May 08, 2014 @12:04PM (#7716015)
The author states that Python is smart enough not to reimport a file that has already been imported. Is that not the case here?