Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71542

RE: Exception problem with module

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject RE: Exception problem with module
Date 2014-05-14 09:21 +0000
References <mailman.9975.1400000510.18130.python-list@python.org> <5372b2ae$0$29977$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.9994.1400059319.18130.python-list@python.org> (permalink)

Show all headers | View raw


> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Exception problem with module "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-05-13 16:59 +0000
  Re: Exception problem with module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-14 00:02 +0000
    RE: Exception problem with module "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-05-14 09:21 +0000
      Re: Exception problem with module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-14 13:08 +0000
        Re: Exception problem with module Chris Angelico <rosuav@gmail.com> - 2014-05-14 23:17 +1000
        RE: Exception problem with module "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-05-19 23:48 +0000

csiph-web