{"id":196918,"date":"2013-10-09T13:38:02","date_gmt":"2013-10-09T09:38:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=196918"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=196918","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 Python<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e, \u043d\u043e \u043c\u0430\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c python, \u043a\u0430\u043a \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (coroutines). <br \/>  \u0421\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u0445 (\u0438\u043c\u0438, \u043e\u043d\u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f).<br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438. \u0410 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/h4>\n<p>  \u041b\u044e\u0431\u043e\u0439 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430 Python \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b. \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438.<\/p>\n<p>  \u042f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<br \/>  \u0412\u043e\u0437\u044c\u043c\u0451\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<pre><code class=\"python\">def read_file_line_by_line(file_name):   with open(file_name, 'r') as f:       while True:         line = f.readline()         if not line:           break         yield line <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0437\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439, \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044f \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. <br \/>  \u0422\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0451\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043b\u0435\u043d\u0438\u0432\u044b\u043c (lazy) \u0447\u0442\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044f, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u00ab\u0440\u0430\u0431\u043e\u0442\u0443\u00bb \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">In [78]: lines_generator = read_file_line_by_line(&quot;data.csv&quot;) In [79]: type(lines_generator) Out[79]: generator In [83]: lines_generator.next() Out[83]: 'time,host,event\\n' In [84]: lines_generator.next() Out[84]: '1374039728,localhost,reboot\\n' In [85]: lines_generator.next() Out[85]: '1374039730,localhost,start\\n' In [86]: lines_generator.next()  ---------------------------------------------------------------------------  StopIteration                             Traceback (most recent call last)  &lt;ipython-input-86-65df1a2cb71b&gt; in &lt;module&gt;()  ----&gt; 1 lines_generator.next()  StopIteration:   # \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e 3 \u0441\u0442\u0440\u043e\u0447\u043a\u0438  # \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0447\u0435\u0433\u043e, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 StopIteration, \u043a\u0430\u043a \u0438 \u0441 \u043b\u044e\u0431\u044b\u043c \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u043e\u044a\u0435\u043a\u0442\u043e\u043c.  <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0430\u0449\u0435 \u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435, \u0430 \u043d\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e.<br \/>  \u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0437 \u0441\u043a\u043e\u043b\u044c \u0443\u0433\u043e\u0434\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">uniq = [] for line in lines_generator:   if line not in uniq:       uniq.append(line) <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"python\">In [92]: gen = (x for x in range(0, 100*10000)) In [93]: gen.next() Out[93]: 0 In [94]: gen.next() Out[94]: 1 In [95]: gen.next() Out[95]: 2 In [96]: gen.next() Out[96]: 3 In [97]: gen.next() Out[97]: 4 <\/code><\/pre>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0441\u043f\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0432\u0435\u0440\u043d\u043e? \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 <code>range(0, 100*10000)<\/code> \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00ab\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f\u00bb \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438.<\/p>\n<h4>\u0421\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432<\/h4>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043e \u0442\u043e\u043c, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u044d\u0442\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0437\u0430\u0442\u0435\u0432\u0430\u043b\u043e\u0441\u044c. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u0432\u0445\u043e\u0434.<\/p>\n<p>  \u041e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442 <a href=\"http:\/\/www.python.org\/dev\/peps\/pep-0342\/\">PEP 342<\/a>.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e.<\/p>\n<pre><code class=\"python\">def calc():     history = []     while True:         x, y = (yield)         if x == 'h':             print history             continue         result = x + y         print result         history.append(result)  c = calc()  print type(c) # &lt;type 'generator'&gt;  c.next() # \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0446\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c c.send(None) c.send((1,2)) # \u0412\u044b\u0432\u0435\u0434\u0435\u0442 3 c.send((100, 30)) # \u0412\u044b\u0432\u0435\u0434\u0435\u0442 130 c.send((666, 0)) # \u0412\u044b\u0432\u0435\u0434\u0435\u0442 666 c.send(('h',0)) # \u0412\u044b\u0432\u0435\u0434\u0435\u0442 [3, 130, 666] c.close() # \u0417\u0430\u043a\u0440\u044b\u0432\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 <\/code><\/pre>\n<p>  \u0422.\u0435. \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0435\u0433\u043e \u0438 \u043f\u043e\u0434\u0430\u0451\u043c \u0435\u043c\u0443 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. <br \/>  \u041e\u043d, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438<i> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0451 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u043b\u0438<\/i>. \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 <i>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0443\u0434\u0430, \u043e\u0442\u043a\u0443\u0434\u0430 \u0435\u0433\u043e \u0432\u044b\u0437\u0432\u0430\u043b\u0438<\/i>. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u0422\u0430\u043a, \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0432\u0440\u043e\u0434\u0435, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. <br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u0431\u0430\u0432\u0438\u043c \u0441\u0435\u0431\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0440\u0443\u043a\u0430\u043c\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. <br \/>  \u0420\u0435\u0448\u0438\u043c \u044d\u0442\u043e \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c, \u0434\u043b\u044f \u043f\u0438\u0442\u043e\u043d\u0430, \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<pre><code class=\"python\">def coroutine(f):     def wrap(*args,**kwargs):         gen = f(*args,**kwargs)         gen.send(None)         return gen     return wrap   @coroutine def calc():     history = []     while True:         x, y = (yield)         if x == 'h':             print history             continue         result = x + y         print result         history.append(result) <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 (\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435) \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h5>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/h5>\n<p>  \u0425\u043e\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435), \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u041e\u041e\u041f. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0432\u0430\u0448\u0435\u043c \u0430\u0440\u0441\u0435\u043d\u0430\u043b\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b, \u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u0446\u0438\u0439 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0451\u0432\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  \u0414\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0442 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/196918\/\"> http:\/\/habrahabr.ru\/post\/196918\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e, \u043d\u043e \u043c\u0430\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c python, \u043a\u0430\u043a \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (coroutines). <br \/>  \u0421\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u0445 (\u0438\u043c\u0438, \u043e\u043d\u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f).<br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438. \u0410 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-196918","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=196918"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/196918\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}