>> 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...
>
> The advantage for the user is:
/snip
Hey Steven,
Sorry for the late reply (travelling). My comment wasn't clear, I wa
On Wed, May 14, 2014 at 11:08 PM, Steven D'Aprano
wrote:
> One should code as if the next person who reads your program is an easily
> upset psychotic axe-murderer who knows where you live. You wouldn't
> condone writing y = x.__add__(1) instead of y = x + 1, you shouldn't
> condone writing module
On Wed, 14 May 2014 09:21:50 +, Joseph L. Casale wrote:
>> 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
> 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
On Tue, 13 May 2014 16:59:46 +, Joseph L. Casale wrote:
> I am working with a module that I am seeing some odd behavior.
>
> A module.foo builds a custom exception, module.foo.MyError, its done
> right afaict.
>
> Another module, module.bar imports this and calls
> bar.__setattr__('a_new_nam
> Best would be to print out what's in a_new_name to see if it really is
> what you think it is. If you think it is what you think it is, have a
> look at its __mro__ (method resolution order, it's an attribute of
> every class), to see what it's really inheriting. That should show you
> what's hap
On Wed, May 14, 2014 at 2:59 AM, Joseph L. Casale
wrote:
> During handling of the above exception, another exception occurred:
>
> File "C:/dir/test.py", line 12, in
> except a_new_name as exc:
> TypeError: catching classes that do not inherit from BaseException is not
> allowed
Best woul