Home  >  Q&A  >  body text

死活看不懂Python的多进程?

threading
今天看了好多个不同的教程,就是不理解具体是为什么。
是因为需要背景知识?
本人的资历很差,我是完全门外汉一路自学Python,也没有人请教。
大概实际的学习从今年2月开始,到现在时间也不短了,(之前时间在学习Linux命令操作,再之前完全0基础不知道一切关于IT的)
现在的水平只能写点简单的静态页面的爬虫,连urllib,urllib2模块都用不好,想高端点实现个多线程,进而去了解所谓的什么分布式,但是我发现自己太笨拙,别人一个月时间就可以写个基于Python的豆瓣FM命令行,我却只能依葫芦画瓢用Django写个功能简单的博客网站,前端用的还是Bootstrap,照搬官网的Demo改了点条条线线。虽然网站部署出来了,自己之前也搞了域名云主机,但是实在不好意思告诉人,因为看着views里面空空如也仅有的一点过程式代码,冗余和几乎无功能,也就是渲染渲染HTML而已。

在Github上看别人写的简单的代码,比如别人的Django博客,views.py里面使用的都是面向对象的方法,自己竟然都不知道该从哪里看起,更别说看懂了。

有时候有一些高级语法也想不起来,要再搜一下才能看懂。比如说 Parent.__init__(self)
其实就是调用父类的__init__ 自己好像也哪里见到过,但就是死活想不起来。连语法的关都没过!网上不少人建议多看别人的项目,但是我发现基本上都看不懂,有的即使有一些注释我也不知道该怎么理清楚它的结构。
这真的是脑子太笨了吗?

ringa_leeringa_lee2742 days ago1090

reply all(12)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 15:10:19

    Hello, I’m sorry, I accidentally followed you here again~
    Processes and threads are concepts in the operating system. General-purpose programming languages ​​​​like Python only provide an interface for you to use, and its meaning is only to abstract it into something that is easy for people to use. Based on this understanding, I believe that the subject should first understand the meaning of processes and threads at the operating system level, and then talk about their use after understanding them. By then, I’m afraid it won’t matter what language you use. It’s just a matter of reading the API documentation.

    I thought that the knowledge in each professional subject is partially ordered and can be regarded as a tree structure. Some knowledge nodes need to be learned in order. Fortunately, with the current education system, any professional subject has a relatively clear learning route (courses, teachers, books). The subject's dissatisfaction in studying the question is probably because he is constructing new branches and leaves on a certain branch of his personal knowledge tree. Naturally, he will feel that it is "not smooth" and he should go back and sort it out.

    Well, after looking at other respondents’ answers, I found some of them slightly inappropriate, mainly in:

    • @1111 GIL only affects threads, just open multiple processes. What's more, its existence is transparent and does not affect the use of thread and process APIs.
    • @rsj217 Talent is a very vague thing, and it seems to be a bit scientific. So I think that only after you work hard in the right direction can you get your turn to talk about talent, otherwise it makes no sense.

    I suddenly thought of Mensa members again. These people were coaxed by the "IQ test" (what is the scientific basis for this thing?). They held parties and played puzzle games with the theme of IQ/talent. Well, it should be quite interesting, and maybe it can solve the single problem of some men and women. Hahahahahaha~

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 15:10:19

    Spray him GIL. . .

    reply
    0
  • Cancelreply