On Fri, Jan 23, 2009 at 6:23 AM, Alan Gauld <alan.ga...@btinternet.com> wrote:

> Rather than editing the existing code and making it non standard
> why not subclass robotparser:
>
> class WP_RobotParser(robotparser):
>   def __init__(self, *args, *kwargs):
>         robotparser.__init__(self, *args, *kwargs)
>         self.addheaders = .......blah....
>
> Thats one of the advantages of OOP, you can change the way
> classes work without modifying the original code. And thus not
> breaking any code that relies on the original behaviour.

That won't work, it is urllib.URLOpener() that he is patching and
robotparser does not supply a way to change the URLOpener subclass
that it uses.

Ken
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to