{"id":189882,"date":"2013-08-13T09:34:03","date_gmt":"2013-08-13T05:34:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=189882"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=189882","title":{"rendered":"<span class=\"post_title\">\u041e\u0431 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 namedtuple<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <i>\u041c\u044b \u0432 <a href=\"http:\/\/buruki.ru\">\u0411\u0443\u0440\u0443\u043a\u0430\u0445<\/a> \u043b\u044e\u0431\u0438\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"http:\/\/habrahabr.ru\/company\/buruki\/blog\/188218\/\">\u043b\u044e\u0434\u0435\u0439<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/company\/buruki\/blog\/189280\/\">\u0446\u0438\u0444\u0440\u044b<\/a>. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u0443\u0441\u0442\u0430\u043b\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0443\u0435\u043c\u0441\u044f \u0432\u043e \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u044f\u0437\u044b\u043a\u043e\u043c Python. <a href=\"http:\/\/hantim.ru\/jobs\/21698-python-django-razrabotchik\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a> \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u043c\u0438. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435-\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0430\u0432\u0442\u043e\u0440 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <code>namedtuple<\/code> \u0438 \u043f\u043e \u0445\u043e\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u044f\u0437\u044b\u043a\u0430.<\/i><\/p>\n<p>  \u041f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434 \u044f \u0431\u044b\u043b \u043d\u0430 \u043f\u0443\u0442\u0438 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e. \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0432 \u0441\u0430\u043c\u043e\u043b\u0451\u0442\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0447\u0438\u0442\u0430\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Python 2.7. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>namedtuple<\/code> \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043c\u043d\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0430 \u0434\u0435\u043b\u0435 \u0432\u0441\u0451 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u044f \u0434\u0443\u043c\u0430\u043b \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<p>  \u0412\u043e\u0442 <a href=\"http:\/\/hg.python.org\/releasing\/2.7.3\/file\/7bb96963d067\/Lib\/collections.py#l232\">\u0437\u0434\u0435\u0441\u044c<\/a> \u043b\u0435\u0436\u0430\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u043e <code>namedtuple<\/code>, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"http:\/\/pymotw.com\/2\/collections\/namedtuple.html\">\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f<\/a> \u0441 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<p>  <\/p>\n<pre><code class=\"python\">################################################################################ ### namedtuple ################################################################################<\/code><\/pre>\n<p>  \u041e\u0433\u043e! \u0412\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043f\u0440\u0430\u0432\u0434\u0430?<\/p>\n<p>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435, \u043a\u0430\u043a \u0438 \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e <a href=\"http:\/\/docs.python.org\/2\/library\/doctest.html\">\u0434\u043e\u043a\u0442\u0435\u0441\u0442\u0430<\/a>.<\/p>\n<pre><code class=\"python\">def namedtuple(typename, field_names, verbose=False, rename=False):     &quot;&quot;&quot;\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0441 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438.      &gt;&gt;&gt; Point = namedtuple('Point', 'x y')     &gt;&gt;&gt; Point.__doc__                   # \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430     'Point(x, y)'     &gt;&gt;&gt; p = Point(11, y=22)             # \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0438 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438     &gt;&gt;&gt; p[0] + p[1]                     # \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0440\u0442\u0435\u0436     33     &gt;&gt;&gt; x, y = p                        # \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0440\u0442\u0435\u0436     &gt;&gt;&gt; x, y     (11, 22)     &gt;&gt;&gt; p.x + p.y                       # \u043f\u043e\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043f\u043e \u0438\u043c\u0435\u043d\u0438     33     &gt;&gt;&gt; d = p._asdict()                 # \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c     &gt;&gt;&gt; d['x']     11     &gt;&gt;&gt; Point(**d)                      # \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f     Point(x=11, y=22)     &gt;&gt;&gt; p._replace(x=100)               # \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f     Point(x=100, y=22)      &quot;&quot;&quot; <\/code><\/pre>\n<p>  \u041f\u043e\u0442\u043e\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u043a\u0438 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"http:\/\/docs.python.org\/2\/library\/functions.html#basestring\"><code>basestring<\/code><\/a> \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 <a href=\"http:\/\/docs.python.org\/2\/library\/functions.html#isinstance\"><code>isinstance<\/code><\/a> \u2014 \u0442\u0430\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0435\u0441\u043b\u0438 \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>unicode<\/code> \u0438\u043b\u0438 <code>str<\/code> (\u044d\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Python &lt; 3.0).<\/p>\n<pre><code class=\"python\">    # \u041f\u0430\u0440\u0441\u0438\u043c \u0438 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u0432\u0443\u043c \u0446\u0435\u043b\u044f\u043c:     # \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445     # \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0430\u0442\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435\u043c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u044b.     if isinstance(field_names, basestring):         field_names = field_names.replace(',', ' ').split() # \u0438\u043c\u0435\u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438\/\u0438\u043b\u0438 \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438 <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>rename<\/code>, \u0442\u043e \u0432\u0441\u0435 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u043c.<\/p>\n<pre><code class=\"python\">    field_names = tuple(map(str, field_names))     if rename:         names = list(field_names)         seen = set()         for i, name in enumerate(names):             if (not all(c.isalnum() or c=='_' for c in name) or _iskeyword(name)                 or not name or name[0].isdigit() or name.startswith('_')                 or name in seen):                 names[i] = '_%d' % i             seen.add(name)         field_names = tuple(names) <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043e\u0431\u0451\u0440\u043d\u0443\u0442\u043e\u0435 \u0432 <a href=\"http:\/\/docs.python.org\/2\/library\/functions.html#all\"><code>all()<\/code><\/a>. \u0422\u0430\u043a\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c, <code>all(bool_expr(x) for x in things)<\/code>, \u2014 \u043a\u0440\u0430\u0439\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438.<\/p>\n<pre><code class=\"python\">    for name in (typename,) + field_names:         if not all(c.isalnum() or c=='_' for c in name):             raise ValueError(                 'Type names and field names can only contain alphanumeric characters and underscores: %r' % name             )         if _iskeyword(name):             raise ValueError('Type names and field names cannot be a keyword: %r' % name)         if name[0].isdigit():             raise ValueError('Type names and field names cannot start with a number: %r' % name) <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043a\u0430 \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u0438\u043c\u0451\u043d:<\/p>\n<pre><code class=\"python\">    seen_names = set()     for name in field_names:         if name.startswith('_') and not rename:             raise ValueError('Field names cannot start with an underscore: %r' % name)         if name in seen_names:             raise ValueError('Encountered duplicate field name: %r' % name)         seen_names.add(name) <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0435\u0441\u0435\u043b\u044c\u0435. (\u042f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0432\u0435\u0441\u0435\u043b\u043e). \u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u0434\u0430. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0438 \u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0441\u0440\u0435\u0437\u043e\u0432 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <code>argtxt<\/code>.<\/p>\n<pre><code class=\"python\">    # \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043b\u0430\u0441\u0441\u0430     numfields = len(field_names)     argtxt = repr(field_names).replace(&quot;'&quot;, &quot;&quot;)[1:-1]   # \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0431\u0435\u0437 \u043a\u0430\u0432\u044b\u0447\u0435\u043a \u0438 \u0441\u043a\u043e\u0431\u043e\u043a     reprtxt = ', '.join('%s=%%r' % name for name in field_names) <\/code><\/pre>\n<p>  \u0418 \u0432\u043e\u0442 \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c <code>namedtuple<\/code>. \u042d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0432 Python-\u043a\u043e\u0434.<\/p>\n<pre><code class=\"python\">    template = '''class %(typename)s(tuple):         '%(typename)s(%(argtxt)s)' \\n         __slots__ = () \\n         _fields = %(field_names)r \\n          def __new__(_cls, %(argtxt)s):             'Create new instance of %(typename)s(%(argtxt)s)'             return _tuple.__new__(_cls, (%(argtxt)s)) \\n          @classmethod         def _make(cls, iterable, new=tuple.__new__, len=len):             'Make a new %(typename)s object from a sequence or iterable'             result = new(cls, iterable)             if len(result) != %(numfields)d:                 raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))             return result \\n          def __repr__(self):             'Return a nicely formatted representation string'             return '%(typename)s(%(reprtxt)s)' %% self \\n          def _asdict(self):             'Return a new OrderedDict which maps field names to their values'             return OrderedDict(zip(self._fields, self)) \\n          __dict__ = property(_asdict) \\n          def _replace(_self, **kwds):             'Return a new %(typename)s object replacing specified fields with new values'             result = _self._make(map(kwds.pop, %(field_names)r, _self))             if kwds:                 raise ValueError('Got unexpected field names: %%r' %% kwds.keys())             return result \\n          def __getnewargs__(self):             'Return self as a plain tuple.  Used by copy and pickle.'             return tuple(self) \\n\\n                  ''' % locals() <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"http:\/\/docs.python.org\/2\/library\/functions.html#locals\"><code>locals()<\/code><\/a> \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u041f\u0438\u0442\u043e\u043d\u0443 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0412 Groovy \u0438 CoffeeScript, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"http:\/\/coffeescriptcookbook.com\/chapters\/strings\/interpolation\">\u043c\u043e\u0436\u043d\u043e<\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <code>&quot;{name} is {some_value}&quot;<\/code>. \u041d\u043e \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 Python-\u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u0439\u0434\u0451\u0442: <code>&quot;{name} is {some_value}&quot;.format(**locals())<\/code>.<\/p>\n<p>  \u0412\u044b, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e <a href=\"http:\/\/docs.python.org\/2\/reference\/datamodel.html#slots\"><code>__slots__<\/code><\/a> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043e\u0440\u0442\u0435\u0436. \u041f\u0438\u0442\u043e\u043d \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438\u043c\u0451\u043d, \u0447\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (<code>tuple<\/code>), \u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <code>__slots__ = ()<\/code>), \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b <code>namedtuple<\/code>-\u0442\u0438\u043f\u043e\u0432 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <a href=\"http:\/\/c2.com\/cgi\/wiki?ValueObject\">\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/a>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445.<\/p>\n<p>  \u0418\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0438\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. <code>_itemgetter<\/code> \u2014 \u044d\u0442\u043e <a href=\"http:\/\/docs.python.org\/2\/library\/operator.html#operator.itemgetter\"><code>itemgetter<\/code><\/a> \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f <a href=\"http:\/\/docs.python.org\/2\/library\/operator.html\"><code>operator<\/code><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<pre><code class=\"python\">    for i, name in enumerate(field_names):         template += &quot;        %s = _property(_itemgetter(%d), doc='Alias for field number %d')\\n&quot; % (name, i, i)     if verbose:         print template <\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0440\u0430\u043d\u0434\u0438\u043e\u0437\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0441 \u043f\u0438\u0442\u043e\u043d\u044f\u0447\u044c\u0438\u043c \u043a\u043e\u0434\u043e\u043c. \u0427\u0442\u043e \u0441 \u043d\u0435\u0439 \u0434\u0435\u043b\u0430\u0442\u044c? \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u0442\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"http:\/\/docs.python.org\/2\/reference\/simple_stmts.html#the-exec-statement\"><code>exec ... in<\/code><\/a>:<\/p>\n<pre><code class=\"python\">    # \u0418\u0441\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d.     # \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u0432, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     # frame.f_globals['__name__']     namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename,                      OrderedDict=OrderedDict, _property=property, _tuple=tuple)     try:         exec template in namespace     except SyntaxError, e:         raise SyntaxError(e.message + ':\\n' + template)     result = namespace[typename] <\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0445\u0438\u0442\u0440\u043e! \u0418\u0434\u0435\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043d\u0435\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430 \u0434\u043b\u044f \u043c\u0435\u043d\u044f. \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043e\u0431 <code>exec<\/code> \u0438\u0434\u0451\u043c \u0432 <a href=\"http:\/\/lucumr.pocoo.org\/2011\/2\/1\/exec-in-python\/\">\u043f\u043e\u0441\u0442<\/a> \u0410\u0440\u043c\u0438\u043d\u0430 \u0420\u043e\u043d\u0430\u0445\u0435\u0440\u0430.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <code>__module__<\/code> \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u0432\u0430\u043b <code>namedtuple<\/code>:<\/p>\n<pre><code class=\"python\">    try:         result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')     except (AttributeError, ValueError):         pass <\/code><\/pre>\n<p>  \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451!<\/p>\n<pre><code class=\"python\">    return result <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?<\/p>\n<h4>\u041c\u044b\u0441\u043b\u0438 \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h4>\n<p>  \u0421\u0430\u043c\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u044e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u043e\u0442 \u0445\u043e\u0434 \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u041f\u0438\u0442\u043e\u043d\u0430: \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0451\u043d, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u043e\u0434\u0443\u043b\u0438 \u0438 \u043a\u043b\u0430\u0441\u0441\u044b, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u043c\u0438. \u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 <code>namedtuple<\/code> \u0441\u043d\u043e\u0432\u0430 \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u043e\u0449\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b.<br \/>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439, \u0438 \u0432\u043c\u0435\u0441\u0442\u043e<\/p>\n<pre><code class=\"python\">for name in (typename,) + field_names:     if not all(c.isalnum() or c=='_' for c in name):         raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name)     if _iskeyword(name):         raise ValueError('Type names and field names cannot be a keyword: %r' % name)     if name[0].isdigit():         raise ValueError('Type names and field names cannot start with a number: %r' % name) <\/code><\/pre>\n<p>  \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c<\/p>\n<pre><code class=\"python\">for name in (typename,) + field_names:     try:         exec (&quot;%s = True&quot; % name) in {}     except (SyntaxError, NameError):         raise ValueError('Invalid field name: %r' % name) <\/code><\/pre>\n<p>  \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u044f\u043c\u043e \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430. \u041d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u043c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438. \u0410 \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0442\u043e \u044f\u0432\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0434\u0435\u043b\u0430\u044e\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043b\u0443\u0447\u0448\u0438\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043c.<\/p>\n<h4>\u041c\u0435\u0436\u0434\u0443 \u043d\u0430\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <code>find<\/code><\/h4>\n<p>  \u041d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0432\u0435\u0437\u043b\u043e, \u0447\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u041f\u0438\u0442\u043e\u043d\u0430 \u0442\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c, \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e!<\/p>\n<p>  <i>\u0418 \u0432\u043e\u043e\u0431\u0449\u0435. \u0418\u0437\u0443\u0447\u0430\u0439\u0442\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c.<\/i>   \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\/company\/buruki\/blog\/189882\/\"> http:\/\/habrahabr.ru\/company\/buruki\/blog\/189882\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       <i>\u041c\u044b \u0432 <a href=\"http:\/\/buruki.ru\">\u0411\u0443\u0440\u0443\u043a\u0430\u0445<\/a> \u043b\u044e\u0431\u0438\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"http:\/\/habrahabr.ru\/company\/buruki\/blog\/188218\/\">\u043b\u044e\u0434\u0435\u0439<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/company\/buruki\/blog\/189280\/\">\u0446\u0438\u0444\u0440\u044b<\/a>. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0431\u0435\u0437 \u0443\u0441\u0442\u0430\u043b\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0443\u0435\u043c\u0441\u044f \u0432\u043e \u0432\u043b\u0430\u0434\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u044f\u0437\u044b\u043a\u043e\u043c Python. <a href=\"http:\/\/hantim.ru\/jobs\/21698-python-django-razrabotchik\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a> \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0430\u043c\u0438. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435-\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0430\u0432\u0442\u043e\u0440 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <code>namedtuple<\/code> \u0438 \u043f\u043e \u0445\u043e\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u044f\u0437\u044b\u043a\u0430.<\/i><\/p>\n<p>  \u041f\u0430\u0440\u0443 \u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434 \u044f \u0431\u044b\u043b \u043d\u0430 \u043f\u0443\u0442\u0438 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e. \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0432 \u0441\u0430\u043c\u043e\u043b\u0451\u0442\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0447\u0438\u0442\u0430\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Python 2.7. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>namedtuple<\/code> \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043c\u043d\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0430 \u0434\u0435\u043b\u0435 \u0432\u0441\u0451 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u044f \u0434\u0443\u043c\u0430\u043b \u0440\u0430\u043d\u044c\u0448\u0435.<\/p>\n<p>  \u0412\u043e\u0442 <a href=\"http:\/\/hg.python.org\/releasing\/2.7.3\/file\/7bb96963d067\/Lib\/collections.py#l232\">\u0437\u0434\u0435\u0441\u044c<\/a> \u043b\u0435\u0436\u0430\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u043e <code>namedtuple<\/code>, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"http:\/\/pymotw.com\/2\/collections\/namedtuple.html\">\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f<\/a> \u0441 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439.<\/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-189882","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/189882","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=189882"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/189882\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=189882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=189882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=189882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}