How to except the unexpected?
James Stroud
jstroud at ucla.edu
Sat Mar 4 18:00:19 EST 2006
Paul Rubin wrote:
> James Stroud <jstroud at ucla.edu> writes:
>
>>>approach. Basically this is reverse engineering the interface from the
>>>source at the time of writing the app.
>>
>>This is using the source as documentation, there is no law against
>>that.
>
> That's completely bogus. Undocumented interfaces in the library
> source are allowed to change between Python versions and across Python
> implementations. If you write your application according to the
> documented interfaces in the Python manual, it should not break when
> someone upgrades to the next Python release. You should not have to
> depend on undocumented aspects of the Python implementation which
> change out of sync with the application.
>
My suggestion was to use some common sense about the source code and
apply it. I've wasted many hours programming to faulty documentation
when a quick peek at the source code would have saved some serious time.
How do you think I happened accross the technique?
I would wager that, in 10 years time, the urllib2 module will not raise
any exceptions that don't inheret from urllib2.URLError or a built-in
(i.e. documented) exception; unless, of course, someone made a change in
a deliberate attempt to win said wager ;o)
>>How things are and how things should be have always been 2 entirely
>>different things. See early books by Robert J. Ringer for a more
>>complete discussion.
>
> That's like saying programs shouldn't have bugs, but they often do
> anyway. It doesn't mean the bugs are a good thing or that they
> shouldn't be fixed.
The original reference was to the internet, which seems vast in its
sources of unforseen peril. If some gracious soul aspires to fix every
bug in the internet, I invite him to be my guest.
James
More information about the Python-list
mailing list