发布时间:2019-08-31 10:12:23编辑:auto阅读(2945)
async_call.py
#coding:utf-8
from threading import Thread
def async_call(fn):
    def wrapper(*args, **kwargs):
        Thread(target=fn, args=args, kwargs=kwargs).start()
    return wrapper
test.py
from time import sleep
from async_call import async_call
class AA:
    @async_call
    def hello( self ):
        self.__count += 1
        print(int(time.()))
        sleep(2)
        print(int(time.()))
        return
if __name__ == "__main__":
    AA().hello()
 
上一篇: python使用wget下载网络文件
下一篇: python中开n次方根
 51253
 50691
 41288
 38110
 32572
 29473
 28336
 23198
 23163
 21491
 1566°
 2285°
 1894°
 1831°
 2147°
 1877°
 2567°
 4299°
 4153°
 2961°