subclass urllib2
Santoso Wijaya
santoso.wijaya at gmail.com
Mon Feb 28 14:07:00 EST 2011
1. Why are you subclassing a module?
2. If you want to "mask" a module's version attribute, just do this:
>>> import urllib2
>>> urllib2.__version__ = 'foo'
>>> print urllib2.__version__
foo
~/santa
On Mon, Feb 28, 2011 at 10:53 AM, monkeys paw <monkey at joemoney.net> wrote:
> I'm trying to subclass urllib2 in order to mask the
> version attribute. Here's what i'm using:
>
> import urllib2
>
> class myURL(urllib2):
> def __init__(self):
> urllib2.__init__(self)
> self.version = 'firefox'
>
> I get this>
> Traceback (most recent call last):
> File "<interactive input>", line 1, in <module>
> TypeError: Error when calling the metaclass bases
> module.__init__() takes at most 2 arguments (3 given)
>
> I don't see where i am supplying 3 arguments. What am i
> missing?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110228/827f37a2/attachment-0001.html>
More information about the Python-list
mailing list