Exception problem with module

Joseph L. Casale jcasale at activenetwerx.com
Wed May 14 05:21:50 EDT 2014


> I see that you've solved your immediate problem, but you shouldn't call 
> __setattr__ directly. That should actually be written
>
>     setattr(bar, 'a_new_name', MyError)
>
> But really, since bar is (apparently) a module, and it is *bar itself* 
> setting the attribute, the better way is
>
> a_new_name = MyError
>
> or even 
>
> from module.foo import MyError as a_new_name

Well I am not sure what advantage this has for the user, not my code as
I don't advocate the import to begin with it, its fine spelled as it was from
where it was... I'll look back at this and see if that resolves the issue as it
had manifested.

jlc



More information about the Python-list mailing list