calling class methods from class methods, help?

Piet van Oostrum piet at cs.uu.nl
Wed Mar 11 19:00:04 CET 2009


>>>>> Oltmans <rolf.oltmans at gmail.com> (O) escribió:

>O> I've a multithreaded program in which I've to call class methods from
>O> class methods. Here is how my code look like (excluding imports),. Any
>O> help is highly appreciated.

>O> #!/usr/bin/env python
>O> class Requests(Thread):

>O>     def __init__(self, times):
>O>         Thread.__init__(self)
>O>         self.times=times
>O>         self.name=''
>O>     def run(self):

>O>         sites=['example.com','example1.com']
>O>         for i in range(0,self.times):
>O>             for site in sites:
>O>                 self.name = site
>O>                 self.html=SendRequest() # This line throws an error

                    self.html=self.SendRequest()
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list