Python
Nick-_-Song
一个想成为大神的程序猿
展开
-
一个例子理解 Python 内置装饰器及 cached_property
# coding=utf-8from functools import cached_propertyclass Test: c = 3 def __init__(self, *args, **kwargs): self.a = 1 @property def aaa(self): print("I'm in aaa") # 可以通过 self.a 或者 self.c 访问 a 和 c 变量 retu原创 2021-08-08 18:58:03 · 927 阅读 · 0 评论 -
Python 多进程实操
文章目录Python 多进程多进程创建方式多进程如何进行数据交互?Python 多进程多进程创建方式Python 中使用 multiprocessing 模块来处理多进程。直接创建 Process 对象# -*- coding:utf-8 -*-from multiprocessing import Processimport os, timedef fun(i): print(f"I'm in {os.getpid()}, id is {i}, parent pid is{原创 2021-08-07 20:03:08 · 224 阅读 · 0 评论