SHARE
    TWEET
    Krenair

    Untitled

    Oct 20th, 2011
    129
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    Python 0.44 KB | None | 0 0
    1. alex@alex:~$ python
    2. Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
    3. [GCC 4.5.2] on linux2
    4. Type "help", "copyright", "credits" or "license" for more information.
    5. >>> from threading import Thread
    6. >>> class SomeClass:
    7. ... def somemethod(self):
    8. ... print "hi"
    9. ...
    10. >>> someclass = SomeClass()
    11. >>> Thread(target=someclass.somemethod, args=[]).start()
    12. hi
    13. >>> Thread(target=SomeClass.somemethod, args=[someclass]).start()
    14. hi
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /