On Dec 24, 1:24 am, Steven D'Aprano <steve +comp.lang.pyt...@pearwood.info> wrote: > On Thu, 23 Dec 2010 22:38:05 -0800, Carl Banks wrote: > > OTOH, going the extra mile to hide useful information from a user is > > asinine. As a user, I will decide for myself how I want to use > > implementation-defined information, and I don't want the implementor to > > decide this for me. It's bad enough if an implementor fails to provide > > information out of laziness, but when they deliberately do extra work to > > hide information, that's self-importance and arrogance. > > But that of course is nonsense, because as the user you don't decide > anything of the sort.
As a user I can criticize the decision of the implementor to needlessly filter information, and declare that it's borne out of the author's arrogance in thinking he knows what I want when I get a traceback. I can also opine that Python language shouldn't make it easy for library implementors to be arrogant like this. > The developer responsible for writing the function > decides what information he provides you, starting with whether you get > an exception at all, where it comes from, the type of exception, and the > error message (if any). Once this information has been passed on to you, > you're free to do anything you like with it, but you never get to choose > what information you get -- I'm not suggesting any change there. All I'm > suggesting is that there should be a way of reducing the boilerplate > needed for this idiom: > > def _validate_arg(x): > if x == 'bad input': return False > return True > > def f(arg): > if not _validate_arg(arg): > raise ValueError > process(arg) > > to something more natural that doesn't needlessly expose implementation > details that are completely irrelevant to the caller. Arrogance. Who gave you the right to decide what is completely irrelevant to user? I, as the user, decide what's relevant. If I want implementation-dependent information, it's my business. I don't want the language to make it easy for arrogant people, who think they know what information I want better than I do, to hide that information from me. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list