Is there any way to access attributes from an imported module?

Andrew Berg bahamutzero8825 at gmail.com
Sun Oct 2 22:21:41 EDT 2011


I found a way to do it, albeit a very hackish one. Since the class
instance already catches exceptions from the modules it imports, I can
make a custom exception (in a common area for both it and the submodules
to import) for it to catch and have it call its own methods there based
on information stored in the exception. I'm eventually going to redesign
it to be cleaner and more obvious, but for now, this is a nice
quick-and-dirty solution.

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0



More information about the Python-list mailing list