Dilras's recent timeline updates
Dilras

Dilras

V2EX member #410689, joined on 2019-05-09 16:26:45 +08:00
Dilras's recent replies
大屏放代码,小屏摸鱼
Aug 2, 2019
Replied to a topic by Thymolblue Python 不懂就问: Python 脚本 并行
Aug 2, 2019
Replied to a topic by Thymolblue Python 不懂就问: Python 脚本 并行
1. 简单说'__main__'是模块默认的名字,这么写的意思是只在直接运行这个模块的时候执行后面的代码,如果它被 import 到其它模块,后面的不执行。
2. 多进程,多线程都是抢占式调度,由操作系统控制,所以执行的顺序是不可预料的。可以用锁保护非原子操作。
3. 进程和进程池的区别,process 就是单个进程,pool 是一开始直接创建多个进程,用到时就从里面拿,用完放回去。
4. 英文 OK 的话,推荐 https://realpython.com/learning-paths/python-concurrency-parallel-programming/这个系列,中文可以读 Cookbook 中对应的章节,书有开源翻译版
Jun 29, 2019
Replied to a topic by caneman Python Python 元类这样用会产生问题吗?
不需要创建 obj,atts 字典里面本身就存着函数对象,所以直接 append 就好了
```python
class Metaclass(type):

func_list = []

def __new__(mcs, name, base, attrs):
for k,v in attrs.items():
if k.startswith('at'):
mcs.func_list.append(v)
return type.__new__(mcs, name, base, attrs)
```
应届生可以吗?
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2502 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 06:21 · PVG 14:21 · LAX 23:21 · JFK 02:21
♥ Do have faith in what you're doing.