n00b with urllib2: How to make it handle cookie automatically?
Steve Holden
steve at holdenweb.com
Sat Feb 23 08:23:01 EST 2008
7stud wrote:
> On Feb 21, 11:50 pm, est <electronix... at gmail.com> wrote:
>> class SmartRequest():
>>
>
> You should always define a class like this:
>
> class SmartRequest(object):
>
>
> unless you know of a specific reason not to.
>
>
It's much easier, though, just to put
__metaclass__ = type
at the start of any module where you want exlusively new-style objects.
And I do agree that you should use exclusively new-style objects without
a good reason for not doing, though thanks to Guido's hard work it
mostly doesn't matter.
$ cat test94.py
__metaclass__ = type
class Rhubarb:
pass
rhubarb = Rhubarb()
print type(Rhubarb)
print type(rhubarb)
$ python test94.py
<type 'type'>
<class '__main__.Rhubarb'>
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list