"Language-Team: Persian (https://github.com/python/python-docs-fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.6\n"
msgid"Simple statements"
msgstr"دستورهای ساده"
msgid"A simple statement is comprised within a single logical line. Several simple statements may occur on a single line separated by semicolons. The syntax for simple statements is:"
msgstr"یک دستور ساده در یک خط منطقی جای میگیرد. چند دستور ساده ممکن است در یک خط بیایند و با نقطهویرگول از هم جدا شوند. سینتکس دستورات ساده به این صورت است:"
msgid"Expression statements"
msgstr"دستورهای عبارت"
msgid"Expression statements are used (mostly interactively) to compute and write a value, or (usually) to call a procedure (a function that returns no meaningful result; in Python, procedures return the value ``None``). Other uses of expression statements are allowed and occasionally useful. The syntax for an expression statement is:"
msgstr"دستورهای عبارت (بیشتر بهصورت تعاملی) برای محاسبه و نوشتن یک مقدار، یا (معمولاً) برای فراخوانی یک رویه (تابعی که هیچ نتیجهی معناداری برنمیگرداند؛ در پایتون، رویهها مقدار ``None`` را برمیگردانند) استفاده میشوند. سایر کاربردهای دستورهای عبارت مجاز هستند و گاهی مفیدند. سینتکس یک دستور عبارت به این صورت است:"
msgid"An expression statement evaluates the expression list (which may be a single expression)."
msgstr"یک دستور عبارتی، فهرست عبارتها را ارزیابی میکند (که ممکن است یک عبارت واحد باشد)."
msgid"In interactive mode, if the value is not ``None``, it is converted to a string using the built-in :func:`repr` function and the resulting string is written to standard output on a line by itself (except if the result is ``None``, so that procedure calls do not cause any output.)"
msgstr"در حالت تعاملی، اگر مقدار ``None`` نباشد، با استفاده از تابع توکار :func:`repr` به یک رشته تبدیل میشود و رشته حاصل در یک خط جداگانه در خروجی استاندارد نوشته میشود (مگر اینکه نتیجه ``None`` باشد، تا فراخوانیهای رویه هیچ خروجی ایجاد نکنند.)"
msgid"Assignment statements"
msgstr"دستورهای انتساب"
msgid"Assignment statements are used to (re)bind names to values and to modify attributes or items of mutable objects:"
msgstr"دستورهای انتساب برای (باز)مقیدسازی نامها به مقادیر و تغییر ویژگیها یا آیتمهای اشیاء تغییرپذیر استفاده میشوند:"
msgid"(See section :ref:`primaries` for the syntax definitions for *attributeref* and *subscription*.)"
msgstr"(برای تعاریف سینتکس *attributeref* و *subscription* به بخش :ref:`primaries` مراجعه کنید.)"
msgid"An assignment statement evaluates the expression list (remember that this can be a single expression or a comma-separated list, the latter yielding a tuple) and assigns the single resulting object to each of the target lists, from left to right."
msgstr"یک دستور انتساب، فهرست عبارتها را ارزیابی میکند (به یاد داشته باشید که این میتواند یک عبارت واحد یا فهرستی جداشده با ویرگول باشد که دومی یک تاپل به دست میدهد) و تنها شیء حاصل را به هر یک از فهرستهای هدف، از چپ به راست، اختصاص میدهد."
msgid"Assignment is defined recursively depending on the form of the target (list). When a target is part of a mutable object (an attribute reference or subscription), the mutable object must ultimately perform the assignment and decide about its validity, and may raise an exception if the assignment is unacceptable. The rules observed by various types and the exceptions raised are given with the definition of the object types (see section :ref:`types`)."
msgstr"انتساب بسته به شکل فهرست هدف بهصورت بازگشتی تعریف میشود. هنگامی که یک هدف بخشی از یک شیء تغییرپذیر باشد (ارجاع به ویژگی یا زیرنویسی)، شیء تغییرپذیر باید در نهایت انتساب را انجام دهد و درباره اعتبار آن تصمیم بگیرد، و ممکن است در صورت غیرقابلقبول بودن انتساب، استثنا پرتاب کند. قواعدی که انواع مختلف رعایت میکنند و استثناهایی که پرتاب میشوند، همراه با تعریف انواع شیء آمدهاند (بخش :ref:`types` را ببینید)."
msgid"Assignment of an object to a target list, optionally enclosed in parentheses or square brackets, is recursively defined as follows."
msgstr"انتساب یک شیء به یک فهرست هدف، که بهاختیار در پرانتز یا کروشه قرار گرفته است، بهصورت بازگشتی بهشکل زیر تعریف میشود."
msgid"If the target list is a single target with no trailing comma, optionally in parentheses, the object is assigned to that target."
msgstr"اگر فهرست هدف، یک هدف واحد بدون ویرگول پایانی باشد که بهاختیار داخل پرانتز قرار گرفته است، شیء به آن هدف انتساب میشود."
msgid"Else:"
msgstr"در غیر این صورت:"
msgid"If the target list contains one target prefixed with an asterisk, called a \"starred\" target: The object must be an iterable with at least as many items as there are targets in the target list, minus one. The first items of the iterable are assigned, from left to right, to the targets before the starred target. The final items of the iterable are assigned to the targets after the starred target. A list of the remaining items in the iterable is then assigned to the starred target (the list can be empty)."
msgstr"اگر فهرست هدف شامل یک هدف با پیشوند ستاره باشد که هدف «ستارهدار» نامیده میشود: شیء باید پیمایشپذیری باشد که تعداد آیتمهای آن حداقل برابر با تعداد هدفهای موجود در فهرست هدف، منهای یک، باشد. آیتمهای نخست پیمایشپذیر، از چپ به راست، به هدفهای پیش از هدف ستارهدار اختصاص داده میشوند. آیتمهای پایانی پیمایشپذیر به هدفهای پس از هدف ستارهدار اختصاص داده میشوند. سپس فهرستی از آیتمهای باقیمانده در پیمایشپذیر به هدف ستارهدار اختصاص داده میشود (این فهرست میتواند خالی باشد)."
msgid"Else: The object must be an iterable with the same number of items as there are targets in the target list, and the items are assigned, from left to right, to the corresponding targets."
msgstr"در غیر این صورت: شیء باید پیمایشپذیری باشد که همان تعداد آیتم را داشته باشد که هدفها در فهرست هدف وجود دارند، و آیتمها از چپ به راست، به هدفهای متناظر اختصاص داده میشوند."
msgid"Assignment of an object to a single target is recursively defined as follows."
msgstr"انتساب یک شیء به یک هدف واحد، بهصورت بازگشتی به شکل زیر تعریف شده است."
msgid"If the target is an identifier (name):"
msgstr"اگر هدف یک شناسه (نام) باشد:"
msgid"If the name does not occur in a :keyword:`global` or :keyword:`nonlocal` statement in the current code block: the name is bound to the object in the current local namespace."
msgstr"اگر نام در یک دستور :keyword:`global` یا :keyword:`nonlocal` در بلوک کد فعلی وجود نداشته باشد: نام به شیء در فضای نام محلی فعلی پیوند داده میشود."
msgid"Otherwise: the name is bound to the object in the global namespace or the outer namespace determined by :keyword:`nonlocal`, respectively."
msgstr"در غیر این صورت: نام بهترتیب در فضای نام سراسری یا فضای نام بیرونی تعیینشده توسط :keyword:`nonlocal` به شیء پیوند داده میشود."
msgid"The name is rebound if it was already bound. This may cause the reference count for the object previously bound to the name to reach zero, causing the object to be deallocated and its destructor (if it has one) to be called."
msgstr"اگر نام از قبل مقید شده باشد، دوباره مقید میشود. این ممکن است باعث شود شمار ارجاع شیءای که پیشتر به آن نام مقید شده بود به صفر برسد و در نتیجه، شیء آزاد شود و مخرب آن (اگر داشته باشد) فراخوانی شود."
msgid"If the target is an attribute reference: The primary expression in the reference is evaluated. It should yield an object with assignable attributes; if this is not the case, :exc:`TypeError` is raised. That object is then asked to assign the assigned object to the given attribute; if it cannot perform the assignment, it raises an exception (usually but not necessarily :exc:`AttributeError`)."
msgstr"اگر هدف یک ارجاع به ویژگی باشد: عبارت اصلی در ارجاع ارزیابی میشود. این عبارت باید شیءای با ویژگیهای قابل انتساب حاصل کند؛ در غیر این صورت، :exc:`TypeError` پرتاب میشود. سپس از آن شیء خواسته میشود که شیء انتسابدادهشده را به ویژگی دادهشده انتساب دهد؛ اگر نتواند این انتساب را انجام دهد، یک استثنا پرتاب میکند (معمولاً اما نه لزوماً :exc:`AttributeError`)."
msgid"Note: If the object is a class instance and the attribute reference occurs on both sides of the assignment operator, the right-hand side expression, ``a.x`` can access either an instance attribute or (if no instance attribute exists) a class attribute. The left-hand side target ``a.x`` is always set as an instance attribute, creating it if necessary. Thus, the two occurrences of ``a.x`` do not necessarily refer to the same attribute: if the right-hand side expression refers to a class attribute, the left-hand side creates a new instance attribute as the target of the assignment::"
msgstr"نکته: اگر شیء نمونهای از کلاس باشد و ارجاع به ویژگی در هر دو طرف عملگر انتساب رخ دهد، عبارت سمت راست، ``a.x`` میتواند به یک ویژگی نمونه یا (اگر ویژگی نمونه وجود نداشته باشد) به یک ویژگی کلاس دسترسی داشته باشد. هدف سمت چپ ``a.x`` همیشه بهعنوان یک ویژگی نمونه تنظیم میشود و در صورت لزوم ایجاد میگردد. بنابراین، دو مورد از ``a.x`` لزوماً به یک ویژگی اشاره نمیکنند: اگر عبارت سمت راست به یک ویژگی کلاس اشاره کند، سمت چپ یک ویژگی نمونه جدید را بهعنوان هدف انتساب ایجاد میکند::"
msgid""
"class Cls:\n"
" x = 3 # class variable\n"
"inst = Cls()\n"
"inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3"
msgstr""
"class Cls:\n"
" x = 3 # class variable\n"
"inst = Cls()\n"
"inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3"
msgid"This description does not necessarily apply to descriptor attributes, such as properties created with :deco:`property`."
msgstr"این توضیح لزوماً در مورد ویژگیهای توصیفگر، مانند پراپرتیهایی که با :deco:`property` ایجاد شدهاند، صدق نمیکند."
msgid"If the target is a subscription: The primary expression in the reference is evaluated. Next, the subscript expression is evaluated. Then, the primary's :meth:`~object.__setitem__` method is called with two arguments: the subscript and the assigned object."
msgstr"اگر هدف یک زیرنویسی (subscription) باشد: عبارت اصلیِ ارجاع ارزیابی میشود. سپس، عبارت زیرنویس (subscript) ارزیابی میشود. آنگاه متد :meth:`~object.__setitem__`\\ عبارت اصلی با دو آرگومان فراخوانی میشود: زیرنویس و شیء تخصیصیافته."
msgid"Typically, :meth:`~object.__setitem__` is defined on mutable sequence objects (such as lists) and mapping objects (such as dictionaries), and behaves as follows."
msgstr"معمولاً :meth:`~object.__setitem__` روی اشیاء دنبالهای تغییرپذیر (مانند فهرستها) و اشیاء نگاشت (مانند دیکشنریها) تعریف میشود و بهصورت زیر رفتار میکند."
msgid"If the primary is a mutable sequence object (such as a list), the subscript must yield an integer. If it is negative, the sequence's length is added to it. The resulting value must be a nonnegative integer less than the sequence's length, and the sequence is asked to assign the assigned object to its item with that index. If the index is out of range, :exc:`IndexError` is raised (assignment to a subscripted sequence cannot add new items to a list)."
msgstr"اگر شیء اصلی یک دنبالهی تغییرپذیر (مانند یک فهرست) باشد، عبارت اندیسدهی باید یک عدد صحیح تولید کند. اگر این مقدار منفی باشد، طول دنباله به آن افزوده میشود. مقدار حاصل باید یک عدد صحیح نامنفی کوچکتر از طول دنباله باشد، و از دنباله خواسته میشود شیء مورد انتساب را به آیتم خود در آن اندیس اختصاص دهد. اگر اندیس خارج از محدوده باشد، :exc:`IndexError` پرتاب میشود (انتساب به یک دنبالهی اندیسدهیشده نمیتواند آیتمهای جدیدی به یک فهرست اضافه کند)."
msgid"If the primary is a mapping object (such as a dictionary), the subscript must have a type compatible with the mapping's key type, and the mapping is then asked to create a key/value pair which maps the subscript to the assigned object. This can either replace an existing key/value pair with the same key value, or insert a new key/value pair (if no key with the same value existed)."
msgstr"اگر شیء اصلی یک شیء نگاشت (مانند یک دیکشنری) باشد، زیرنویس باید نوعی سازگار با نوع کلید نگاشت داشته باشد، و سپس از نگاشت خواسته میشود یک جفت کلید/مقدار ایجاد کند که زیرنویس را به شیء انتسابدادهشده نگاشت میکند. این عمل میتواند یک جفت کلید/مقدار موجود با همان مقدار کلید را جایگزین کند یا یک جفت کلید/مقدار جدید درج کند (اگر هیچ کلیدی با همان مقدار وجود نداشته باشد)."
msgid"If the target is a slicing: The primary expression should evaluate to a mutable sequence object (such as a list). The assigned object should be :term:`iterable`. The slicing's lower and upper bounds should be integers; if they are ``None`` (or not present), the defaults are zero and the sequence's length. If either bound is negative, the sequence's length is added to it. The resulting bounds are clipped to lie between zero and the sequence's length, inclusive. Finally, the sequence object is asked to replace the slice with the items of the assigned sequence. The length of the slice may be different from the length of the assigned sequence, thus changing the length of the target sequence, if the target sequence allows it."
msgstr "اگر هدف یک اسلایس باشد: عبارت اصلی باید به یک شیء دنباله تغییرپذیر (مانند یک فهرست) ارزیابی شود. شیء انتسابیافته باید :term:`پیمایشپذیر <iterable>` باشد. کرانهای پایین و بالای اسلایس باید عدد صحیح باشند؛ اگر آنها ``None`` باشند (یا وجود نداشته باشند)، مقادیر پیشفرض ۰ و طول دنباله هستند. اگر هر یک از کرانها منفی باشد، طول دنباله به آن افزوده میشود. کرانهای حاصل بهگونهای محدود میشوند که بین ۰ و طول دنباله (شامل هر دو) قرار گیرند. در نهایت، از شیء دنباله خواسته میشود که اسلایس را با آیتمهای دنباله انتسابیافته جایگزین کند. طول اسلایس ممکن است با طول دنباله انتسابیافته متفاوت باشد، و در نتیجه اگر دنباله هدف اجازه دهد، طول دنباله هدف تغییر میکند."
msgid"Although the definition of assignment implies that overlaps between the left-hand side and the right-hand side are 'simultaneous' (for example ``a, b = b, a`` swaps two variables), overlaps *within* the collection of assigned-to variables occur left-to-right, sometimes resulting in confusion. For instance, the following program prints ``[0, 2]``::"
msgstr"اگرچه تعریف انتساب دلالت بر این دارد که همپوشانیهای میان سمت چپ و سمت راست «همزمان» هستند (برای مثال ``a, b = b, a`` دو متغیر را جابهجا میکند)، اما همپوشانیهای *درون* مجموعهی متغیرهایی که به آنها انتساب داده میشود بهترتیب از چپ به راست رخ میدهند و گاهی موجب سردرگمی میشوند. برای مثال، برنامهی زیر ``[0, 2]`` را چاپ میکند::"
msgid""
"x = [0, 1]\n"
"i = 0\n"
"i, x[i] = 1, 2 # i is updated, then x[i] is updated\n"
"print(x)"
msgstr""
"x = [0, 1]\n"
"i = 0\n"
"i, x[i] = 1, 2 # i is updated, then x[i] is updated\n"
msgid"The specification for the ``*target`` feature."
msgstr"مشخصات قابلیت ``*target``."
msgid"Augmented assignment statements"
msgstr"دستورهای انتساب افزوده"
msgid"Augmented assignment is the combination, in a single statement, of a binary operation and an assignment statement:"
msgstr"انتساب افزایشی، ترکیبی از یک عملیات دودویی و یک دستور انتساب در یک دستور واحد است:"
msgid"(See section :ref:`primaries` for the syntax definitions of the last three symbols.)"
msgstr"(برای تعاریف سینتکس سه نماد آخر، بخش :ref:`primaries` را ببینید.)"
msgid"An augmented assignment evaluates the target (which, unlike normal assignment statements, cannot be an unpacking) and the expression list, performs the binary operation specific to the type of assignment on the two operands, and assigns the result to the original target. The target is only evaluated once."
msgstr"یک انتساب افزوده، هدف (که برخلاف دستورهای انتساب معمولی، نمیتواند واگشایی باشد) و فهرست عبارتها را ارزیابی میکند، عملیات دودویی متناسب با نوع انتساب را روی دو عملوند انجام میدهد و نتیجه را به هدف اولیه انتساب میدهد. هدف فقط یک بار ارزیابی میشود."
msgid"An augmented assignment statement like ``x += 1`` can be rewritten as ``x = x + 1`` to achieve a similar, but not exactly equal effect. In the augmented version, ``x`` is only evaluated once. Also, when possible, the actual operation is performed *in-place*, meaning that rather than creating a new object and assigning that to the target, the old object is modified instead."
msgstr"یک دستور انتساب افزایشی مانند ``x += 1`` را میتوان بهصورت ``x = x + 1`` بازنویسی کرد تا اثری مشابه، اما نه دقیقاً برابر، بهدست آید. در حالت افزایشی، ``x`` تنها یک بار ارزیابی میشود. همچنین، در صورت امکان، عملیات واقعی بهصورت *درجا* انجام میشود، به این معنا که بهجای ایجاد یک شیء جدید و اختصاص آن به هدف، شیء قدیمی تغییر مییابد."
msgid"Unlike normal assignments, augmented assignments evaluate the left-hand side *before* evaluating the right-hand side. For example, ``a[i] += f(x)`` first looks-up ``a[i]``, then it evaluates ``f(x)`` and performs the addition, and lastly, it writes the result back to ``a[i]``."
msgstr"برخلاف انتسابهای معمولی، انتسابهای افزوده سمت چپ را *پیش از* ارزیابی سمت راست ارزیابی میکنند. برای مثال، ``a[i] += f(x)`` ابتدا ``a[i]`` را جستوجو میکند، سپس ``f(x)`` را ارزیابی میکند و عمل جمع را انجام میدهد، و در نهایت، نتیجه را دوباره در ``a[i]`` مینویسد."
msgid"With the exception of assigning to tuples and multiple targets in a single statement, the assignment done by augmented assignment statements is handled the same way as normal assignments. Similarly, with the exception of the possible *in-place* behavior, the binary operation performed by augmented assignment is the same as the normal binary operations."
msgstr"بهاستثنای انتساب به تاپلها و اهداف چندگانه در یک دستور، انتسابی که توسط دستورهای انتساب افزوده انجام میشود، به همان شیوهی انتسابهای عادی مدیریت میشود. به همین ترتیب، بهاستثنای رفتار احتمالی *درجا*، عملیات دودویی انجامشده توسط انتساب افزوده، همانند عملیاتهای دودویی عادی است."
msgid"For targets which are attribute references, the same :ref:`caveat about class and instance attributes <attr-target-note>` applies as for regular assignments."
msgstr"برای اهدافی که ارجاع به ویژگی هستند، همان :ref:`هشدار درباره ویژگیهای کلاس و نمونه <attr-target-note>` همانند انتسابهای معمولی صدق میکند."
msgid"Annotated assignment statements"
msgstr"دستورهای انتساب حاشیهنویسیشده"
msgid":term:`Annotation <variable annotation>` assignment is the combination, in a single statement, of a variable or attribute annotation and an optional assignment statement:"
msgstr"انتساب :term:`حاشیهنویسی <variable annotation>` ترکیب یک حاشیهنویسی متغیر یا ویژگی و یک دستور انتساب اختیاری در یک دستور واحد است:"
msgid"The difference from normal :ref:`assignment` is that only a single target is allowed."
msgstr"تفاوت آن با :ref:`انتساب <assignment>` معمولی در این است که تنها یک هدف مجاز است."
msgid"The assignment target is considered \"simple\" if it consists of a single name that is not enclosed in parentheses. For simple assignment targets, if in class or module scope, the annotations are gathered in a lazily evaluated :ref:`annotation scope <annotation-scopes>`. The annotations can be evaluated using the :attr:`~object.__annotations__` attribute of a class or module, or using the facilities in the :mod:`annotationlib` module."
msgstr"هدف انتساب در صورتی «ساده» در نظر گرفته میشود که تنها شامل یک نام واحد باشد و آن نام در پرانتز قرار نداشته باشد. برای اهداف انتساب ساده، اگر در محدوده کلاس یا ماژول باشند، حاشیهنویسیها در یک :ref:`محدوده حاشیهنویسی <annotation-scopes>` که بهصورت تنبل ارزیابی میشود جمعآوری میشوند. میتوان حاشیهنویسیها را با استفاده از ویژگی :attr:`~object.__annotations__` یک کلاس یا ماژول، یا با استفاده از امکانات ماژول :mod:`annotationlib` ارزیابی کرد."
msgid"If the assignment target is not simple (an attribute, subscript node, or parenthesized name), the annotation is never evaluated."
msgstr"اگر هدف انتساب ساده نباشد (یک ویژگی، گره اندیسدهی، یا نام داخل پرانتز)، حاشیهنویسی هرگز ارزیابی نمیشود."
msgid"If a name is annotated in a function scope, then this name is local for that scope. Annotations are never evaluated and stored in function scopes."
msgstr"اگر نامی در محدوده تابع حاشیهنویسی شده باشد، این نام برای آن محدوده محلی است. حاشیهنویسیها هرگز ارزیابی نمیشوند و در محدودههای تابع ذخیره نمیشوند."
msgid"If the right hand side is present, an annotated assignment performs the actual assignment as if there was no annotation present. If the right hand side is not present for an expression target, then the interpreter evaluates the target except for the last :meth:`~object.__setitem__` or :meth:`~object.__setattr__` call."
msgstr"اگر سمت راست وجود داشته باشد، یک انتساب حاشیهنویسیشده، انتساب واقعی را چنان انجام میدهد که گویی حاشیهنویسی وجود ندارد. اگر سمت راست برای یک هدف عبارتی وجود نداشته باشد، مفسر هدف را بهجز آخرین فراخوانی :meth:`~object.__setitem__` یا :meth:`~object.__setattr__` ارزیابی میکند."
msgid":pep:`526` - Syntax for Variable Annotations"
msgstr":pep:`526` - سینتکس حاشیهنویسی متغیرها"
msgid"The proposal that added syntax for annotating the types of variables (including class variables and instance variables), instead of expressing them through comments."
msgstr"پیشنهادی که سینتکسی برای حاشیهنویسی انواع متغیرها (از جمله متغیرهای کلاس و متغیرهای نمونه) افزود، به جای بیان آنها از طریق کامنتها."
msgid":pep:`484` - Type hints"
msgstr":pep:`484` - راهنماییهای نوع"
msgid"The proposal that added the :mod:`typing` module to provide a standard syntax for type annotations that can be used in static analysis tools and IDEs."
msgstr"پیشنهادی که ماژول :mod:`typing` را برای فراهم کردن یک سینتکس استاندارد برای حاشیهنویسیهای نوع افزود تا در ابزارهای تحلیل ایستا و IDEها قابل استفاده باشد."
msgid"Now annotated assignments allow the same expressions in the right hand side as regular assignments. Previously, some expressions (like un-parenthesized tuple expressions) caused a syntax error."
msgstr"اکنون انتسابهای حاشیهنویسیشده (annotated assignments) اجازه میدهند در سمت راست همان عباراتی به کار روند که در انتسابهای معمولی به کار میروند. پیش از این، برخی عبارات (مانند عبارات تاپلی بدون پرانتز) باعث خطای سینتکسی میشدند."
msgid"Annotations are now lazily evaluated in a separate :ref:`annotation scope <annotation-scopes>`. If the assignment target is not simple, annotations are never evaluated."
msgstr"اکنون حاشیهنویسیها بهصورت تنبل در یک :ref:`محدودهی حاشیهنویسی <annotation-scopes>` جداگانه ارزیابی میشوند. اگر هدف انتساب ساده نباشد، حاشیهنویسیها هرگز ارزیابی نمیشوند."
msgid"The :keyword:`!assert` statement"
msgstr"دستور :keyword:`!assert`"
msgid"Assert statements are a convenient way to insert debugging assertions into a program:"
msgstr"دستورهای assert روشی مناسب برای درج ادعاهای اشکالزدایی در یک برنامه هستند:"
msgid"The simple form, ``assert expression``, is equivalent to ::"
msgstr"شکل ساده، ``assert expression``، معادل است با ::"
msgid""
"if __debug__:\n"
" if not expression: raise AssertionError"
msgstr""
"if __debug__:\n"
" if not expression: raise AssertionError"
msgid"The extended form, ``assert expression1, expression2``, is equivalent to ::"
msgstr"صورت گسترده، ``assert expression1, expression2``، معادل است با ::"
msgid""
"if __debug__:\n"
" if not expression1: raise AssertionError(expression2)"
msgstr""
"if __debug__:\n"
" if not expression1: raise AssertionError(expression2)"
msgid"These equivalences assume that :const:`__debug__` and :exc:`AssertionError` refer to the built-in variables with those names. In the current implementation, the built-in variable ``__debug__`` is ``True`` under normal circumstances, ``False`` when optimization is requested (command line option :option:`-O`). The current code generator emits no code for an :keyword:`assert` statement when optimization is requested at compile time. Note that it is unnecessary to include the source code for the expression that failed in the error message; it will be displayed as part of the stack trace."
msgstr"این معادلها فرض میکنند که :const:`__debug__` و :exc:`AssertionError` به متغیرهای توکار با همان نامها اشاره دارند. در پیادهسازی فعلی، متغیر توکار ``__debug__`` در شرایط عادی ``True`` است و هنگام درخواست بهینهسازی (گزینه خط فرمان :option:`-O`) ``False`` است. تولیدگر کد فعلی، هنگامی که بهینهسازی در زمان کامپایل درخواست شود، هیچ کدی برای یک دستور :keyword:`assert` تولید نمیکند. توجه داشته باشید که نیازی به گنجاندن کد منبع عبارت شکستخورده در پیام خطا نیست؛ این کد بهعنوان بخشی از ردگیری پشته نمایش داده خواهد شد."
msgid"Assignments to :const:`__debug__` are illegal. The value for the built-in variable is determined when the interpreter starts."
msgstr"انتساب به :const:`__debug__` غیرمجاز است. مقدار متغیر توکار هنگام شروع مفسر تعیین میشود."
msgid"The :keyword:`!pass` statement"
msgstr"دستور :keyword:`!pass`"
msgid":keyword:`pass` is a null operation --- when it is executed, nothing happens. It is useful as a placeholder when a statement is required syntactically, but no code needs to be executed, for example::"
msgstr":keyword:`pass` یک عملیات پوچ است — هنگامی که اجرا میشود، هیچ اتفاقی رخ نمیدهد. این بهعنوان یک جاینگهدار مفید است، هنگامی که یک دستور از نظر سینتکسی لازم است اما نیازی به اجرای هیچ کدی نیست، برای مثال::"
msgid""
"def f(arg): pass # a function that does nothing (yet)\n"
"\n"
"class C: pass # a class with no methods (yet)"
msgstr""
"def f(arg): pass # a function that does nothing (yet)\n"
"\n"
"class C: pass # a class with no methods (yet)"
msgid"The :keyword:`!del` statement"
msgstr"دستور :keyword:`!del`"
msgid"Deletion is recursively defined very similar to the way assignment is defined. Rather than spelling it out in full details, here are some hints."
msgstr"حذف بهصورت بازگشتی بسیار مشابه نحوهی تعریف انتساب، تعریف شده است. بهجای بیان آن با تمام جزئیات، در اینجا چند نکته آمده است."
msgid"Deletion of a target list recursively deletes each target, from left to right."
msgstr"حذف یک فهرست هدف، بهصورت بازگشتی هر هدف را از چپ به راست حذف میکند."
msgid"Deletion of a name removes the binding of that name from the local or global namespace, depending on whether the name occurs in a :keyword:`global` statement in the same code block. Trying to delete an unbound name raises a :exc:`NameError` exception."
msgstr"حذف یک نام، بسته به اینکه نام در یک دستور :keyword:`global` در همان بلوک کد آمده باشد، پیوند آن نام را از فضای نام محلی یا سراسری برمیدارد. تلاش برای حذف یک نام بدون پیوند، استثنای :exc:`NameError` را پرتاب میکند."
msgid"Deletion of attribute references and subscriptions is passed to the primary object involved; deletion of a slicing is in general equivalent to assignment of an empty slice of the right type (but even this is determined by the sliced object)."
msgstr"حذف ارجاعهای ویژگی و زیرنویسیها (subscriptions) به شیء اصلی درگیر محول میشود؛ حذف یک اسلایس بهطور کلی معادل انتساب یک اسلایس خالی از نوع صحیح است (اما حتی این مورد نیز توسط شیء اسلایسشده تعیین میشود)."
msgid"Previously it was illegal to delete a name from the local namespace if it occurs as a free variable in a nested block."
msgstr"پیشتر، حذف یک نام از فضای نام محلی در صورتی که آن نام بهعنوان متغیر آزاد در یک بلوک تودرتو ظاهر میشد، غیرمجاز بود."
msgid"The :keyword:`!return` statement"
msgstr"دستور :keyword:`!return`"
msgid":keyword:`return` may only occur syntactically nested in a function definition, not within a nested class definition."
msgstr":keyword:`return` فقط میتواند از نظر سینتکسی بهصورت تودرتو درون یک تعریف تابع ظاهر شود، نه درون یک تعریف کلاس تودرتو."
msgid"If an expression list is present, it is evaluated, else ``None`` is substituted."
msgstr"اگر فهرست عبارت موجود باشد، ارزیابی میشود، در غیر این صورت ``None`` جایگزین میشود."
msgid":keyword:`return` leaves the current function call with the expression list (or ``None``) as return value."
msgstr":keyword:`return` فراخوانی تابع جاری را با فهرست عبارت (یا ``None``) بهعنوان مقدار بازگشتی ترک میکند."
msgid"When :keyword:`return` passes control out of a :keyword:`try` statement with a :keyword:`finally` clause, that :keyword:`!finally` clause is executed before really leaving the function."
msgstr"هنگامی که :keyword:`return` کنترل را از یک دستور :keyword:`try` با بند :keyword:`finally` خارج میکند، آن بند :keyword:`!finally` پیش از خروج واقعی از تابع اجرا میشود."
msgid"In a generator function, the :keyword:`return` statement indicates that the generator is done and will cause :exc:`StopIteration` to be raised. The returned value (if any) is used as an argument to construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` attribute."
msgstr"در یک تابع تولیدگر، دستور :keyword:`return` نشان میدهد که تولیدگر تمام شده است و باعث پرتاب :exc:`StopIteration` میشود. مقدار برگرداندهشده (در صورت وجود) بهعنوان آرگومان برای ساخت :exc:`StopIteration` استفاده میشود و به ویژگی :attr:`StopIteration.value` تبدیل میشود."
msgid"In an asynchronous generator function, an empty :keyword:`return` statement indicates that the asynchronous generator is done and will cause :exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`!return` statement is a syntax error in an asynchronous generator function."
msgstr"در یک تابع تولیدگر ناهمگام، یک دستور :keyword:`return` خالی نشان میدهد که تولیدگر ناهمگام به پایان رسیده است و باعث پرتاب :exc:`StopAsyncIteration` میشود. یک دستور :keyword:`!return` غیرخالی در یک تابع تولیدگر ناهمگام خطای سینتکس است."
msgid"The :keyword:`!yield` statement"
msgstr"دستور :keyword:`!yield`"
msgid"A :keyword:`yield` statement is semantically equivalent to a :ref:`yield expression <yieldexpr>`. The ``yield`` statement can be used to omit the parentheses that would otherwise be required in the equivalent yield expression statement. For example, the yield statements ::"
msgstr"یک دستور :keyword:`yield` از نظر معنایی معادل یک :ref:`عبارت yield <yieldexpr>` است. میتوان از دستور ``yield`` برای حذف پرانتزهایی استفاده کرد که در غیر این صورت در دستور معادل با عبارت yield لازم بودند. برای مثال، دستورات yield ::"
msgid""
"yield <expr>\n"
"yield from <expr>"
msgstr""
"yield <expr>\n"
"yield from <expr>"
msgid"are equivalent to the yield expression statements ::"
msgstr"معادل دستورهای عبارت yield هستند ::"
msgid""
"(yield <expr>)\n"
"(yield from <expr>)"
msgstr""
"(yield <expr>)\n"
"(yield from <expr>)"
msgid"Yield expressions and statements are only used when defining a :term:`generator` function, and are only used in the body of the generator function. Using :keyword:`yield` in a function definition is sufficient to cause that definition to create a generator function instead of a normal function."
msgstr"عبارات و دستورات yield فقط هنگام تعریف یک تابع :term:`تولیدگر <generator>` به کار میروند و فقط در بدنه تابع تولیدگر استفاده میشوند. استفاده از :keyword:`yield` در تعریف تابع، کافی است تا آن تعریف بهجای یک تابع معمولی، یک تابع تولیدگر بسازد."
msgid"For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr` section."
msgstr"برای جزئیات کامل معناشناسی کلیدواژهی :keyword:`yield`، به بخش :ref:`yieldexpr` مراجعه کنید."
msgid"The :keyword:`!raise` statement"
msgstr"دستور :keyword:`!raise`"
msgid"If no expressions are present, :keyword:`raise` re-raises the exception that is currently being handled, which is also known as the *active exception*. If there isn't currently an active exception, a :exc:`RuntimeError` exception is raised indicating that this is an error."
msgstr"اگر هیچ عبارتی وجود نداشته باشد، :keyword:`raise` استثنایی را که در حال حاضر رسیدگی میشود دوباره پرتاب میکند، که به آن *استثنای فعال* نیز گفته میشود. اگر در حال حاضر استثنای فعالی وجود نداشته باشد، یک استثنای :exc:`RuntimeError` پرتاب میشود که نشان میدهد این یک خطا است."
msgid"Otherwise, :keyword:`raise` evaluates the first expression as the exception object. It must be either a subclass or an instance of :class:`BaseException`. If it is a class, the exception instance will be obtained when needed by instantiating the class with no arguments."
msgstr"در غیر این صورت، :keyword:`raise` اولین عبارت را بهعنوان شیء استثنا ارزیابی میکند. این مقدار باید یا یک زیرکلاس از :class:`BaseException` یا یک نمونه از آن باشد. اگر یک کلاس باشد، نمونهی استثنا در صورت نیاز با نمونهسازی آن کلاس بدون آرگومان به دست میآید."
msgid"The :dfn:`type` of the exception is the exception instance's class, the :dfn:`value` is the instance itself."
msgstr":dfn:`type` استثنا، کلاس نمونهی استثنا است و :dfn:`value` خود نمونه است."
msgid"A traceback object is normally created automatically when an exception is raised and attached to it as the :attr:`~BaseException.__traceback__` attribute. You can create an exception and set your own traceback in one step using the :meth:`~BaseException.with_traceback` exception method (which returns the same exception instance, with its traceback set to its argument), like so::"
msgstr"یک شیء ردگیری پشته بهطور معمول بهصورت خودکار هنگامی که یک استثنا پرتاب میشود ایجاد میشود و بهعنوان ویژگی :attr:`~BaseException.__traceback__` به آن متصل میشود. شما میتوانید یک استثنا ایجاد کنید و ردگیری پشتهی خود را در یک مرحله با استفاده از متد :meth:`~BaseException.with_traceback` استثنا تنظیم کنید (که همان نمونهی استثنا را برمیگرداند، در حالی که ردگیری پشتهی آن روی آرگومانش تنظیم شده است)، به این صورت::"
msgid"The ``from`` clause is used for exception chaining: if given, the second *expression* must be another exception class or instance. If the second expression is an exception instance, it will be attached to the raised exception as the :attr:`~BaseException.__cause__` attribute (which is writable). If the expression is an exception class, the class will be instantiated and the resulting exception instance will be attached to the raised exception as the :attr:`!__cause__` attribute. If the raised exception is not handled, both exceptions will be printed:"
msgstr"بند ``from`` برای زنجیرهسازی استثناها استفاده میشود: در صورت ارائه، دومین *عبارت* باید یک کلاس یا نمونه استثنای دیگر باشد. اگر عبارت دوم یک نمونه استثنا باشد، آن نمونه بهعنوان ویژگی :attr:`~BaseException.__cause__` (که قابل نوشتن است) به استثنای پرتابشده ضمیمه میشود. اگر عبارت یک کلاس استثنا باشد، آن کلاس نمونهسازی میشود و نمونه استثنای حاصل بهعنوان ویژگی :attr:`!__cause__` به استثنای پرتابشده ضمیمه میشود. اگر استثنای پرتابشده مدیریت نشود، هر دو استثنا چاپ میشوند:"
msgid""
">>> try:\n"
"... print(1 / 0)\n"
"... except Exception as exc:\n"
"... raise RuntimeError(\"Something bad happened\") from exc\n"
"...\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 2, in <module>\n"
" print(1 / 0)\n"
" ~~^~~\n"
"ZeroDivisionError: division by zero\n"
"\n"
"The above exception was the direct cause of the following exception:\n"
"\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 4, in <module>\n"
" raise RuntimeError(\"Something bad happened\") from exc\n"
"RuntimeError: Something bad happened"
msgstr""
">>> try:\n"
"... print(1 / 0)\n"
"... except Exception as exc:\n"
"... raise RuntimeError(\"Something bad happened\") from exc\n"
"...\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 2, in <module>\n"
" print(1 / 0)\n"
" ~~^~~\n"
"ZeroDivisionError: division by zero\n"
"\n"
"The above exception was the direct cause of the following exception:\n"
"\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 4, in <module>\n"
" raise RuntimeError(\"Something bad happened\") from exc\n"
"RuntimeError: Something bad happened"
msgid"A similar mechanism works implicitly if a new exception is raised when an exception is already being handled. An exception may be handled when an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is used. The previous exception is then attached as the new exception's :attr:`~BaseException.__context__` attribute:"
msgstr"اگر هنگامی که یک استثنا از قبل در حال رسیدگی است، استثنای جدیدی پرتاب شود، سازوکار مشابهی بهصورت ضمنی عمل میکند. یک استثنا ممکن است زمانی رسیدگی شود که از یک بند :keyword:`except` یا :keyword:`finally`، یا یک دستور :keyword:`with` استفاده شود. سپس استثنای پیشین بهعنوان ویژگی :attr:`~BaseException.__context__` به استثنای جدید پیوست میشود:"
msgid""
">>> try:\n"
"... print(1 / 0)\n"
"... except:\n"
"... raise RuntimeError(\"Something bad happened\")\n"
"...\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 2, in <module>\n"
" print(1 / 0)\n"
" ~~^~~\n"
"ZeroDivisionError: division by zero\n"
"\n"
"During handling of the above exception, another exception occurred:\n"
"\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 4, in <module>\n"
" raise RuntimeError(\"Something bad happened\")\n"
"RuntimeError: Something bad happened"
msgstr""
">>> try:\n"
"... print(1 / 0)\n"
"... except:\n"
"... raise RuntimeError(\"Something bad happened\")\n"
"...\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 2, in <module>\n"
" print(1 / 0)\n"
" ~~^~~\n"
"ZeroDivisionError: division by zero\n"
"\n"
"During handling of the above exception, another exception occurred:\n"
"\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 4, in <module>\n"
" raise RuntimeError(\"Something bad happened\")\n"
"RuntimeError: Something bad happened"
msgid"Exception chaining can be explicitly suppressed by specifying :const:`None` in the ``from`` clause:"
msgstr"میتوان زنجیرهسازی استثناها را بهصراحت با مشخص کردن :const:`None` در بند ``from`` سرکوب کرد:"
msgid""
">>> try:\n"
"... print(1 / 0)\n"
"... except:\n"
"... raise RuntimeError(\"Something bad happened\") from None\n"
"...\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 4, in <module>\n"
"RuntimeError: Something bad happened"
msgstr""
">>> try:\n"
"... print(1 / 0)\n"
"... except:\n"
"... raise RuntimeError(\"Something bad happened\") from None\n"
"...\n"
"Traceback (most recent call last):\n"
" File \"<stdin>\", line 4, in <module>\n"
"RuntimeError: Something bad happened"
msgid"Additional information on exceptions can be found in section :ref:`exceptions`, and information about handling exceptions is in section :ref:`try`."
msgstr"اطلاعات بیشتر دربارهی استثناها را میتوانید در بخش :ref:`exceptions` بیابید، و اطلاعات مربوط به مدیریت استثناها در بخش :ref:`try` آمده است."
msgid":const:`None` is now permitted as ``Y`` in ``raise X from Y``."
msgstr":const:`None` اکنون بهعنوان ``Y`` در ``raise X from Y`` مجاز است."
msgid"Added the :attr:`~BaseException.__suppress_context__` attribute to suppress automatic display of the exception context."
msgstr"ویژگی :attr:`~BaseException.__suppress_context__` برای جلوگیری از نمایش خودکار زمینهی استثنا افزوده شد."
msgid"If the traceback of the active exception is modified in an :keyword:`except` clause, a subsequent ``raise`` statement re-raises the exception with the modified traceback. Previously, the exception was re-raised with the traceback it had when it was caught."
msgstr"اگر ردگیری پشتهی استثنای فعال در یک بند :keyword:`except` تغییر داده شود، یک دستور ``raise`` بعدی استثنا را با ردگیری پشتهی تغییریافته دوباره پرتاب میکند. پیش از این، استثنا با ردگیری پشتهای که در زمان گرفته شدن داشت دوباره پرتاب میشد."
msgid"The :keyword:`!break` statement"
msgstr"دستور :keyword:`!break`"
msgid":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :keyword:`while` loop, but not nested in a function or class definition within that loop."
msgstr":keyword:`break` فقط میتواند از نظر سینتکسی بهصورت تودرتو در یک حلقهی :keyword:`for` یا :keyword:`while` قرار گیرد، اما نه بهصورت تودرتو در تعریف تابع یا کلاس درون آن حلقه."
msgid"It terminates the nearest enclosing loop, skipping the optional :keyword:`!else` clause if the loop has one."
msgstr"این دستور نزدیکترین حلقهی دربرگیرنده را خاتمه میدهد و اگر حلقه دارای بند اختیاری :keyword:`!else` باشد، از آن میگذرد."
msgid"If a :keyword:`for` loop is terminated by :keyword:`break`, the loop control target keeps its current value."
msgstr"اگر یک حلقهی :keyword:`for` با :keyword:`break` خاتمه یابد، هدف کنترل حلقه مقدار فعلی خود را حفظ میکند."
msgid"When :keyword:`break` passes control out of a :keyword:`try` statement with a :keyword:`finally` clause, that :keyword:`!finally` clause is executed before really leaving the loop."
msgstr"هنگامی که :keyword:`break` کنترل را از یک دستور :keyword:`try` دارای بند :keyword:`finally` خارج میکند، آن بند :keyword:`!finally` پیش از خروج واقعی از حلقه اجرا میشود."
msgid"The :keyword:`!continue` statement"
msgstr"دستور :keyword:`!continue`"
msgid":keyword:`continue` may only occur syntactically nested in a :keyword:`for` or :keyword:`while` loop, but not nested in a function or class definition within that loop. It continues with the next cycle of the nearest enclosing loop."
msgstr":keyword:`continue` تنها میتواند از نظر سینتکسی درون یک حلقهی :keyword:`for` یا :keyword:`while` قرار گیرد، اما نه درون تعریف یک تابع یا کلاس در داخل آن حلقه. این دستور به چرخهی بعدی نزدیکترین حلقهی دربرگیرنده ادامه میدهد."
msgid"When :keyword:`continue` passes control out of a :keyword:`try` statement with a :keyword:`finally` clause, that :keyword:`!finally` clause is executed before really starting the next loop cycle."
msgstr"هنگامی که :keyword:`continue` کنترل را از یک دستور :keyword:`try` با بند :keyword:`finally` خارج میکند، آن بند :keyword:`!finally` پیش از آغاز واقعی دور بعدی حلقه اجرا میشود."
msgid"The :keyword:`!import` statement"
msgstr"دستور :keyword:`!import`"
msgid"The basic import statement (no :keyword:`from` clause) is executed in two steps:"
msgstr"دستور ایمپورت پایه (بدون بند :keyword:`from`) در دو مرحله اجرا میشود:"
msgid"find a module, loading and initializing it if necessary"
msgstr"یافتن یک ماژول، بارگذاری و مقداردهی اولیهی آن در صورت لزوم"
msgid"define a name or names in the current namespace for the scope where the :keyword:`import` statement occurs, just as an assignment statement would (including :keyword:`global` and :keyword:`nonlocal` semantics)."
msgstr"یک یا چند نام را در فضای نام جاریِ محدودهای که دستور :keyword:`import` در آن رخ میدهد تعریف میکند، دقیقاً همانگونه که یک دستور انتساب این کار را انجام میدهد (شامل معناشناسی :keyword:`global` و :keyword:`nonlocal`)."
msgid"When the statement contains multiple clauses (separated by commas) the two steps are carried out separately for each clause, just as though the clauses had been separated out into individual import statements."
msgstr"هنگامی که دستور شامل چندین بند (جداشده با ویرگول) باشد، دو مرحله برای هر بند بهطور جداگانه انجام میشوند، درست گویی که بندها به دستورات ایمپورت جداگانه تفکیک شده باشند."
msgid"The details of the first step, finding and loading modules, are described in greater detail in the section on the :ref:`import system <importsystem>`, which also describes the various types of packages and modules that can be imported, as well as all the hooks that can be used to customize the import system. Note that failures in this step may indicate either that the module could not be located, *or* that an error occurred while initializing the module, which includes execution of the module's code."
msgstr"جزئیات مرحله اول، یعنی یافتن و بارگذاری ماژولها، با جزئیات بیشتر در بخش مربوط به :ref:`سیستم ایمپورت <importsystem>` توضیح داده شده است، که همچنین انواع مختلف بستهها و ماژولهای قابل ایمپورت، و نیز همه قلابهایی (hooks) را که میتوان از آنها برای سفارشیسازی سیستم ایمپورت استفاده کرد، توصیف میکند. توجه داشته باشید که شکستها در این مرحله ممکن است نشاندهنده این باشند که ماژول یافت نشد، *یا* اینکه هنگام مقداردهی اولیه ماژول، که شامل اجرای کد ماژول نیز میشود، خطایی رخ داده است."
msgid"If the requested module is retrieved successfully, it will be made available in the local namespace in one of three ways:"
msgstr"اگر ماژول درخواستشده با موفقیت بازیابی شود، در فضای نام محلی به یکی از سه روش در دسترس قرار خواهد گرفت:"
msgid"If the module name is followed by :keyword:`!as`, then the name following :keyword:`!as` is bound directly to the imported module."
msgstr"اگر پس از نام ماژول :keyword:`!as` بیاید، نامی که پس از :keyword:`!as` میآید، مستقیماً به ماژول ایمپورتشده متصل میشود."
msgid"If no other name is specified, and the module being imported is a top level module, the module's name is bound in the local namespace as a reference to the imported module"
msgstr"اگر نام دیگری مشخص نشده باشد و ماژولی که ایمپورت میشود یک ماژول سطح بالا باشد، نام ماژول در فضای نام محلی بهعنوان ارجاعی به ماژول ایمپورتشده مقید میشود"
msgid"If the module being imported is *not* a top level module, then the name of the top level package that contains the module is bound in the local namespace as a reference to the top level package. The imported module must be accessed using its full qualified name rather than directly"
msgstr"اگر ماژولی که ایمپورت میشود یک ماژول سطح بالا *نباشد*، آنگاه نام بسته سطح بالایی که آن ماژول را شامل میشود، در فضای نام محلی بهعنوان ارجاعی به بسته سطح بالا مقید میشود. برای دسترسی به ماژول ایمپورتشده باید بهجای دسترسی مستقیم، از نام کامل آن استفاده کنید"
msgid"The :keyword:`from` form uses a slightly more complex process:"
msgstr"قالب :keyword:`from` از فرآیند کمی پیچیدهتری استفاده میکند:"
msgid"find the module specified in the :keyword:`from` clause, loading and initializing it if necessary;"
msgstr"یافتن ماژول مشخصشده در بند :keyword:`from`، بارگذاری و مقداردهی اولیهی آن در صورت نیاز؛"
msgid"for each of the identifiers specified in the :keyword:`import` clauses:"
msgstr"برای هر یک از شناسههایی که در بندهای :keyword:`import` مشخص شدهاند:"
msgid"check if the imported module has an attribute by that name"
msgstr"بررسی کنید که آیا ماژول ایمپورتشده ویژگیای با آن نام دارد یا خیر"
msgid"if not, attempt to import a submodule with that name and then check the imported module again for that attribute"
msgstr"در غیر این صورت، سعی کنید یک زیرماژول با آن نام را ایمپورت کنید و سپس ماژول ایمپورتشده را دوباره برای آن ویژگی بررسی کنید"
msgid"if the attribute is not found, :exc:`ImportError` is raised."
msgstr"اگر ویژگی پیدا نشود، :exc:`ImportError` پرتاب میشود."
msgid"otherwise, a reference to that value is stored in the current namespace, using the name in the :keyword:`!as` clause if it is present, otherwise using the attribute name"
msgstr"در غیر این صورت، ارجاعی به آن مقدار در فضای نام فعلی ذخیره میشود؛ اگر بند :keyword:`!as` وجود داشته باشد، از نامِ موجود در آن استفاده میشود، در غیر این صورت از نام ویژگی استفاده میشود"
"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as fbb\n"
"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as baz\n"
"from foo import attr # foo imported and foo.attr bound as attr"
msgid"If the list of identifiers is replaced by a star (``'*'``), all public names defined in the module are bound in the local namespace for the scope where the :keyword:`import` statement occurs."
msgstr"اگر فهرست شناسهها با یک ستاره (``'*'``) جایگزین شود، همه نامهای عمومی تعریفشده در ماژول، در فضای نام محلیِ محدودهای که دستور :keyword:`import` در آن رخ میدهد، مقید میشوند."
msgid"The *public names* defined by a module are determined by checking the module's namespace for a variable named ``__all__``; if defined, it must be a sequence of strings which are names defined or imported by that module. Names containing non-ASCII characters must be in the `normalization form`_ NFKC; see :ref:`lexical-names-nonascii` for details. The names given in ``__all__`` are all considered public and are required to exist. If ``__all__`` is not defined, the set of public names includes all names found in the module's namespace which do not begin with an underscore character (``'_'``). ``__all__`` should contain the entire public API. It is intended to avoid accidentally exporting items that are not part of the API (such as library modules which were imported and used within the module)."
msgstr "*نامهای عمومی* تعریفشده توسط یک ماژول، با بررسی فضای نام ماژول برای یافتن متغیری به نام ``__all__`` تعیین میشوند؛ در صورت تعریفشدن، باید دنبالهای از رشتهها باشد؛ این رشتهها نامهایی تعریفشده یا ایمپورتشده توسط آن ماژول هستند. نامهای حاوی نویسههای غیر ASCII باید در `normalization form`_ NFKC باشند؛ برای جزئیات، :ref:`lexical-names-nonascii` را ببینید. همهی نامهای دادهشده در ``__all__`` عمومی در نظر گرفته میشوند و باید وجود داشته باشند. اگر ``__all__`` تعریفنشده باشد، مجموعهی نامهای عمومی شامل همهی نامهایی است که در فضای نام ماژول یافت میشوند و با نویسهی زیرخط (``'_'``) آغاز نمیشوند. ``__all__`` باید شامل کل API عمومی باشد. هدف آن جلوگیری از اکسپورت شدن تصادفی آیتمهایی است که بخشی از API نیستند (مانند ماژولهای کتابخانهای که ایمپورتشدهاند و درون ماژول استفادهشدهاند)."
msgid"The wild card form of import --- ``from module import *`` --- is only allowed at the module level. Attempting to use it in class or function definitions will raise a :exc:`SyntaxError`."
msgstr"شکل ایمپورت وایلدکارد --- ``from module import *`` --- فقط در سطح ماژول مجاز است. تلاش برای استفاده از آن در تعریف کلاس یا تابع باعث پرتاب یک :exc:`SyntaxError` میشود."
msgid"When specifying what module to import you do not have to specify the absolute name of the module. When a module or package is contained within another package it is possible to make a relative import within the same top package without having to mention the package name. By using leading dots in the specified module or package after :keyword:`from` you can specify how high to traverse up the current package hierarchy without specifying exact names. One leading dot means the current package where the module making the import exists. Two dots means up one package level. Three dots is up two levels, etc. So if you execute ``from . import mod`` from a module in the ``pkg`` package then you will end up importing ``pkg.mod``. If you execute ``from ..subpkg2 import mod`` from within ``pkg.subpkg1`` you will import ``pkg.subpkg2.mod``. The specification for relative imports is contained in the :ref:`relativeimports` section."
msgstr "هنگام مشخص کردن ماژولی که باید ایمپورت شود، لازم نیست نام مطلق ماژول را مشخص کنید. هنگامی که یک ماژول یا بسته درون بسته دیگری قرار دارد، میتوان بدون ذکر نام بسته، یک ایمپورت نسبی در همان بسته سطح بالا انجام داد. با استفاده از نقطههای ابتدایی در ماژول یا بسته مشخصشده پس از :keyword:`from`، میتوانید مشخص کنید که تا چه سطحی در سلسلهمراتب بسته جاری به بالا پیمایش کنید، بدون آنکه نامهای دقیق را ذکر کنید. ۱ نقطه ابتدایی به معنای بسته جاری است؛ یعنی جایی که ماژول ایمپورتکننده در آن قرار دارد. ۲ نقطه یعنی ۱ سطح بسته بالاتر. ۳ نقطه یعنی ۲ سطح بالاتر، و غیره. بنابراین اگر ``from . import mod`` را از یک ماژول در بسته ``pkg`` اجرا کنید، در نهایت ``pkg.mod`` را ایمپورت خواهید کرد. اگر ``from ..subpkg2 import mod`` را از درون ``pkg.subpkg1`` اجرا کنید، ``pkg.subpkg2.mod`` را ایمپورت خواهید کرد. مشخصات ایمپورتهای نسبی در بخش :ref:`relativeimports` آمده است."
msgid":func:`importlib.import_module` is provided to support applications that determine dynamically the modules to be loaded."
msgstr":func:`importlib.import_module` برای پشتیبانی از برنامههایی ارائه شده است که ماژولهایی را که باید بارگذاری شوند، بهصورت پویا تعیین میکنند."
msgid"Raises an :ref:`auditing event <auditing>` ``import`` with arguments ``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys.path_hooks``."
msgstr"یک :ref:`رویداد حسابرسی <auditing>` ``import`` را با آرگومانهای ``module``، ``filename``، ``sys.path``، ``sys.meta_path`` و ``sys.path_hooks`` پرتاب میکند."
msgid"Lazy imports"
msgstr"ایمپورتهای تنبل"
msgid"The :keyword:`lazy` keyword is a :ref:`soft keyword <soft-keywords>` that only has special meaning when it appears immediately before an :keyword:`import` or :keyword:`from` statement. When an import statement is preceded by the :keyword:`lazy` keyword, the import becomes *lazy*: the module is not loaded immediately at the import statement. Instead, a lazy proxy object is created and bound to the name. The actual module is loaded on first use of that name."
msgstr"کلیدواژهی :keyword:`lazy` یک :ref:`کلیدواژهی نرم <soft-keywords>` است که تنها زمانی معنای ویژهای دارد که بلافاصله پیش از یک دستور :keyword:`import` یا :keyword:`from` ظاهر شود. هنگامی که یک دستور import با کلیدواژهی :keyword:`lazy` پیشوند شود، آن import به صورت *تنبل (lazy)* درمیآید: ماژول بلافاصله در دستور import بارگذاری نمیشود. در عوض، یک شیء پراکسی تنبل ایجاد شده و به نام کران میشود. ماژول واقعی در اولین استفاده از آن نام بارگذاری میشود."
msgid"Lazy imports are only permitted at module scope. Using :keyword:`lazy` inside a function, class body, or :keyword:`try`/:keyword:`except`/:keyword:`finally` block raises a :exc:`SyntaxError`. Star imports cannot be lazy (``lazy from module import *`` is a syntax error), and :ref:`future statements <future>` cannot be lazy."
msgstr"ایمپورتهای تنبل تنها در محدودهی ماژول مجاز هستند. استفاده از :keyword:`lazy` درون یک تابع، بدنهی کلاس، یا بلوک :keyword:`try`/:keyword:`except`/:keyword:`finally` خطای :exc:`SyntaxError` ایجاد میکند. ایمپورتهای ستارهای نمیتوانند تنبل باشند (عبارت ``lazy from module import *`` یک خطای نحوی است)، و :ref:`بیانیههای آینده <future>` نمیتوانند تنبل باشند."
msgid"When using ``lazy from ... import``, each imported name is bound to a lazy proxy object. The first access to any of these names triggers loading of the entire module and resolves only that specific name to its actual value. Other names remain as lazy proxies until they are accessed."
msgstr"هنگام استفاده از ``lazy from ... import``، هر نام ایمپورتشده به یک شیء پراکسی تنبل متصل (bound) میشود. اولین دسترسی به هر یک از این نامها، بارگذاری کل ماژول را فعال میکند و تنها همان نام مشخص را به مقدار واقعیاش حل میکند. سایر نامها تا زمانی که به آنها دسترسی پیدا شود به عنوان پراکسیهای تنبل باقی میمانند."
msgid"Example::"
msgstr"مثال::"
msgid""
"lazy import json\n"
"import sys\n"
"\n"
"print('json' in sys.modules) # False - json module not yet loaded\n"
"\n"
"# First use triggers loading\n"
"result = json.dumps({\"hello\": \"world\"})\n"
"\n"
"print('json' in sys.modules) # True - now loaded"
msgstr""
"lazy import json\n"
"import sys\n"
"\n"
"print('json' in sys.modules) # False - json module not yet loaded\n"
"\n"
"# First use triggers loading\n"
"result = json.dumps({\"hello\": \"world\"})\n"
"\n"
"print('json' in sys.modules) # True - now loaded"
msgid"If an error occurs during module loading (such as :exc:`ImportError` or :exc:`SyntaxError`), it is raised at the point where the lazy import is first used, not at the import statement itself."
msgstr"اگر خطایی در طول بارگذاری ماژول رخ دهد (مانند :exc:`ImportError` یا :exc:`SyntaxError`)، این خطا در نقطهای که ایمپورت تنبل برای اولین بار استفاده میشود بالا برده میشود، نه در خود دستور ایمپورت."
msgid"See :pep:`810` for the full specification of lazy imports."
msgstr"برای مشخصات کامل ایمپورتهای تنبل، به :pep:`810` مراجعه کنید."
msgid"Compatibility via ``__lazy_modules__``"
msgstr"سازگاری از طریق ``__lazy_modules__``"
msgid"As an alternative to using the :keyword:`lazy` keyword, a module can opt into lazy loading for specific imports by defining a module-level :attr:`~module.__lazy_modules__` variable. When present, it must be a container of fully qualified module name strings. Any regular (non-``lazy``) :keyword:`import` statement at module scope whose target appears in :attr:`!__lazy_modules__` is treated as a lazy import, exactly as if the :keyword:`lazy` keyword had been used."
msgstr"بهعنوان جایگزینی برای استفاده از کلیدواژهی :keyword:`lazy`، یک ماژول میتواند با تعریف متغیر :attr:`~module.__lazy_modules__` در سطح ماژول، بارگذاری تنبل را برای واردکردنهای مشخص فعال کند. در صورت وجود این متغیر، باید یک ظرف شامل رشتههایی با نام کامل ماژولها باشد. هر دستور :keyword:`import` معمولی (غیر از ``lazy``) در سطح ماژول که هدف آن در :attr:`!__lazy_modules__` قرار داشته باشد، بهعنوان یک import تنبل در نظر گرفته میشود؛ دقیقاً گویی از کلیدواژهی :keyword:`lazy` استفاده شده است."
msgid"This provides a way to enable lazy loading for specific dependencies without changing individual ``import`` statements. This is useful when supporting Python versions older than 3.15 while using lazy imports in 3.15+::"
msgstr"این روش راهی برای فعال کردن بارگذاری تنبل برای وابستگیهای خاص بدون تغییر دستورات ``import`` فردی فراهم میکند. این کار هنگام پشتیبانی از نسخههای پایتون قدیمیتر از ۳.۱۵ در حالی که از ایمپورتهای تنبل در ۳.۱۵+ استفاده میکنید مفید است::"
msgid""
"__lazy_modules__ = [\"json\", \"pathlib\"]\n"
"\n"
"import json # loaded lazily (name is in __lazy_modules__)\n"
"import os # loaded eagerly (name not in __lazy_modules__)\n"
"\n"
"import pathlib # loaded lazily"
msgstr""
"__lazy_modules__ = [\"json\", \"pathlib\"]\n"
"\n"
"import json # loaded lazily (name is in __lazy_modules__)\n"
"import os # loaded eagerly (name not in __lazy_modules__)\n"
"\n"
"import pathlib # loaded lazily"
msgid"Relative imports are resolved to their absolute name before the lookup, so :attr:`!__lazy_modules__` must always contain fully qualified module names."
msgstr"ایمپورتهای نسبی پیش از جستجو به نام مطلق خود حل میشوند، بنابراین :attr:`!__lazy_modules__` همیشه باید شامل نامهای ماژول با نام کاملاً واجد شرایط باشد."
msgid"For ``from``-style imports, the relevant name is the module following ``from``, not the names of its members::"
msgstr"برای ایمپورتهای سبکیِ ``from``، نام مربوطه ماژولی است که پس از ``from`` میآید، نه نام اعضای آن::"
"import json # loaded eagerly (not in __lazy_modules__)"
msgid"Imports inside functions, class bodies, or :keyword:`try`/:keyword:`except`/:keyword:`finally` blocks are always eager, regardless of :attr:`!__lazy_modules__`."
msgstr"ایمپورتهای درون تابعها، بدنهی کلاسها، یا بلوکهای :keyword:`try`/:keyword:`except`/:keyword:`finally` همیشه مشتاق (eager) هستند، صرفنظر از :attr:`!__lazy_modules__`."
msgid"Future statements"
msgstr"دستورهای آینده"
msgid"A :dfn:`future statement` is a directive to the compiler that a particular module should be compiled using syntax or semantics that will be available in a specified future release of Python where the feature becomes standard."
msgstr"یک :dfn:`future statement` دایرکتیوی به کامپایلر است که یک ماژول خاص باید با استفاده از سینتکس یا معناشناسیای کامپایل شود که در یک نسخه آینده مشخص از پایتون در دسترس خواهد بود، نسخهای که در آن قابلیت استاندارد میشود."
msgid"The future statement is intended to ease migration to future versions of Python that introduce incompatible changes to the language. It allows use of the new features on a per-module basis before the release in which the feature becomes standard."
msgstr"دستور future برای تسهیل مهاجرت به نسخههای آیندهی پایتون که تغییرات ناسازگاری را در زبان معرفی میکنند، در نظر گرفته شده است. این دستور استفاده از قابلیتهای جدید را بهازای هر ماژول، پیش از انتشاری که آن قابلیت استاندارد میشود، ممکن میسازد."
msgid"A future statement must appear near the top of the module. The only lines that can appear before a future statement are:"
msgstr"یک دستور آینده باید نزدیک ابتدای ماژول قرار بگیرد. تنها سطرهایی که میتوانند پیش از یک دستور آینده ظاهر شوند، عبارتاند از:"
msgid"the module docstring (if any),"
msgstr"رشته مستند ماژول (در صورت وجود)،"
msgid"comments,"
msgstr"کامنتها،"
msgid"blank lines, and"
msgstr"سطرهای خالی، و"
msgid"other future statements."
msgstr"دستورهای future دیگر."
msgid"The only feature that requires using the future statement is ``annotations`` (see :pep:`563`)."
msgstr"تنها قابلیتی که نیازمند استفاده از دستور future است، ``annotations`` است (به :pep:`563` مراجعه کنید)."
msgid"All historical features enabled by the future statement are still recognized by Python 3. The list includes ``absolute_import``, ``division``, ``generators``, ``generator_stop``, ``unicode_literals``, ``print_function``, ``nested_scopes`` and ``with_statement``. They are all redundant because they are always enabled, and only kept for backwards compatibility."
msgstr"تمام قابلیتهای تاریخی که با دستور future فعال میشوند، همچنان توسط پایتون 3 شناسایی میشوند. این فهرست شامل ``absolute_import``، ``division``، ``generators``، ``generator_stop``، ``unicode_literals``، ``print_function``، ``nested_scopes`` و ``with_statement`` است. همهی آنها زائد هستند، زیرا همیشه فعالاند و فقط برای سازگاری با نسخههای قدیمی نگه داشته شدهاند."
msgid"A future statement is recognized and treated specially at compile time: Changes to the semantics of core constructs are often implemented by generating different code. It may even be the case that a new feature introduces new incompatible syntax (such as a new reserved word), in which case the compiler may need to parse the module differently. Such decisions cannot be pushed off until runtime."
msgstr"یک دستور future در زمان کامپایل شناخته میشود و بهصورت ویژه با آن رفتار میشود: تغییرات در معناشناسی ساختارهای اصلی اغلب با تولید کد متفاوت پیادهسازی میشوند. حتی ممکن است یک قابلیت جدید، سینتکس ناسازگار جدیدی را معرفی کند (مانند یک کلیدواژه رزروشده جدید)، که در این صورت کامپایلر ممکن است نیاز داشته باشد ماژول را بهشکل متفاوتی تجزیه کند. چنین تصمیماتی را نمیتوان تا رانتایم به تعویق انداخت."
msgid"For any given release, the compiler knows which feature names have been defined, and raises a compile-time error if a future statement contains a feature not known to it."
msgstr"برای هر انتشار مشخص، کامپایلر میداند کدامیک از نامهای ویژگی تعریف شدهاند، و اگر یک دستور future شامل ویژگیای باشد که برای کامپایلر شناختهشده نیست، خطای زمان کامپایل پرتاب میکند."
msgid"The direct runtime semantics are the same as for any import statement: there is a standard module :mod:`__future__`, described later, and it will be imported in the usual way at the time the future statement is executed."
msgstr"معناشناسی مستقیم رانتایم همانند هر دستور ایمپورت است: یک ماژول استاندارد به نام :mod:`__future__` وجود دارد که بعداً توضیح داده شده است و این ماژول در زمان اجرای دستور future به روش معمول ایمپورت میشود."
msgid"The interesting runtime semantics depend on the specific feature enabled by the future statement."
msgstr"معناشناسی قابلتوجه رانتایم به ویژگی خاصی بستگی دارد که با دستور future فعال میشود."
msgid"Note that there is nothing special about the statement::"
msgstr"توجه داشته باشید که هیچ چیز خاصی دربارهی این دستور وجود ندارد::"
msgid"import __future__ [as name]"
msgstr"import __future__ [as name]"
msgid"That is not a future statement; it's an ordinary import statement with no special semantics or syntax restrictions."
msgstr"این یک دستور آینده نیست؛ بلکه یک دستور ایمپورت معمولی بدون معنای خاص یا محدودیتهای سینتکسی خاصی است."
msgid"Code compiled by calls to the built-in functions :func:`exec` and :func:`compile` that occur in a module :mod:`!M` containing a future statement will, by default, use the new syntax or semantics associated with the future statement. This can be controlled by optional arguments to :func:`compile` --- see the documentation of that function for details."
msgstr"کدی که با فراخوانی توابع توکار :func:`exec` و :func:`compile` در ماژول :mod:`!M` حاوی یک دستور آینده (future statement) کامپایل میشود، بهطور پیشفرض از سینتکس یا معناشناسی جدید مرتبط با دستور آینده استفاده میکند. این موضوع را میتوان با آرگومانهای اختیاری :func:`compile` کنترل کرد --- برای جزئیات، مستندات آن تابع را ببینید."
msgid"A future statement typed at an interactive interpreter prompt will take effect for the rest of the interpreter session. If an interpreter is started with the :option:`-i` option, is passed a script name to execute, and the script includes a future statement, it will be in effect in the interactive session started after the script is executed."
msgstr"یک دستور آینده که در اعلان مفسر تعاملی وارد شود، برای ادامهی نشست مفسر اعمال خواهد شد. اگر مفسری با گزینهی :option:`-i` آغاز شود، نام اسکریپتی برای اجرا به آن داده شود و آن اسکریپت شامل یک دستور آینده باشد، آن دستور در نشست تعاملی که پس از اجرای اسکریپت آغاز میشود، معتبر خواهد بود."
msgid":pep:`236` - Back to the __future__"
msgstr":pep:`236` - بازگشت به __future__"
msgid"The original proposal for the __future__ mechanism."
msgstr"پیشنهاد اولیه برای سازوکار __future__."
msgid"The :keyword:`!global` statement"
msgstr"دستور :keyword:`!global`"
msgid"The :keyword:`global` statement causes the listed identifiers to be interpreted as globals. It would be impossible to assign to a global variable without :keyword:`!global`, although free variables may refer to globals without being declared global."
msgstr"دستور :keyword:`global` باعث میشود شناسههای فهرستشده بهعنوان سراسری تفسیر شوند. بدون :keyword:`!global`، انتساب به یک متغیر سراسری غیرممکن خواهد بود، اگرچه متغیرهای آزاد ممکن است بدون اینکه سراسری اعلام شوند، به سراسریها ارجاع دهند."
msgid"The :keyword:`!global` statement applies to the entire current scope (module, function body or class definition). A :exc:`SyntaxError` is raised if a variable is used or assigned to prior to its global declaration in the scope."
msgstr"دستور :keyword:`!global` بر کل محدوده فعلی (ماژول، بدنه تابع یا تعریف کلاس) اعمال میشود. اگر از متغیری پیش از اعلام سراسری آن در محدوده استفاده شود یا به آن انتساب داده شود، یک :exc:`SyntaxError` پرتاب میشود."
msgid"At the module level, all variables are global, so a :keyword:`!global` statement has no effect. However, variables must still not be used or assigned to prior to their :keyword:`!global` declaration. This requirement is relaxed in the interactive prompt (:term:`REPL`)."
msgstr"در سطح ماژول، تمام متغیرها سراسری هستند، بنابراین یک دستور :keyword:`!global` بیاثر است. با این حال، هنوز هم نباید از متغیرها پیش از اعلام آنها بهصورت :keyword:`!global` استفاده کرد یا به آنها انتساب داد. این الزام در خط فرمان تعاملی (:term:`REPL`) سختگیری کمتری دارد."
msgid"**Programmer's note:** :keyword:`global` is a directive to the parser. It applies only to code parsed at the same time as the :keyword:`!global` statement. In particular, a :keyword:`!global` statement contained in a string or code object supplied to the built-in :func:`exec` function does not affect the code block *containing* the function call, and code contained in such a string is unaffected by :keyword:`!global` statements in the code containing the function call. The same applies to the :func:`eval` and :func:`compile` functions."
msgstr"**یادداشت برنامهنویس:** :keyword:`global` دایرکتیو برای پارسر است. این دستور فقط به کدی اعمال میشود که همزمان با دستور :keyword:`!global` تجزیه میشود. بهویژه، دستور :keyword:`!global` موجود در یک رشته یا شیء کدی که به تابع توکار :func:`exec` داده میشود، بر بلوک کد *حاوی* فراخوانی تابع تأثیر نمیگذارد، و کد موجود در چنین رشتهای تحت تأثیر دستورات :keyword:`!global` در کد حاوی فراخوانی تابع قرار نمیگیرد. همین موضوع در مورد توابع :func:`eval` و :func:`compile` نیز صدق میکند."
msgid"The :keyword:`!nonlocal` statement"
msgstr"دستور :keyword:`!nonlocal`"
msgid"When the definition of a function or class is nested (enclosed) within the definitions of other functions, its nonlocal scopes are the local scopes of the enclosing functions. The :keyword:`nonlocal` statement causes the listed identifiers to refer to names previously bound in nonlocal scopes. It allows encapsulated code to rebind such nonlocal identifiers. If a name is bound in more than one nonlocal scope, the nearest binding is used. If a name is not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:`SyntaxError` is raised."
msgstr "هنگامی که تعریف یک تابع یا کلاس بهصورت تودرتو (محصورشده) درون تعاریف توابع دیگر قرار میگیرد، محدودههای غیرمحلی آن، محدودههای محلی توابع دربرگیرنده هستند. دستور :keyword:`nonlocal` باعث میشود شناسههای فهرستشده به نامهایی ارجاع دهند که پیشتر در محدودههای غیرمحلی متصل شدهاند. این دستور به کد محصورشده اجازه میدهد چنین شناسههای غیرمحلی را دوباره متصل کند. اگر نامی در بیش از یک محدوده غیرمحلی متصل شده باشد، نزدیکترین اتصال استفاده میشود. اگر نامی در هیچ محدوده غیرمحلی متصل نشده باشد، یا اگر محدوده غیرمحلی وجود نداشته باشد، یک :exc:`SyntaxError` پرتاب میشود."
msgid"The :keyword:`nonlocal` statement applies to the entire scope of a function or class body. A :exc:`SyntaxError` is raised if a variable is used or assigned to prior to its nonlocal declaration in the scope."
msgstr"دستور :keyword:`nonlocal` به تمام محدودهی بدنهی یک تابع یا کلاس اعمال میشود. اگر یک متغیر پیش از اعلام nonlocal آن در محدوده استفاده شود یا به آن مقدار اختصاص داده شود، یک :exc:`SyntaxError` پرتاب میشود."
msgid":pep:`3104` - Access to Names in Outer Scopes"
msgstr":pep:`3104` - دسترسی به نامها در محدودههای بیرونی"
msgid"The specification for the :keyword:`nonlocal` statement."
msgstr"مشخصات دستور :keyword:`nonlocal`."
msgid"**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and applies only to code parsed along with it. See the note for the :keyword:`global` statement."
msgstr"**یادداشت برنامهنویس:** :keyword:`nonlocal` یک دایرکتیو برای پارسر است و فقط به کدی اعمال میشود که همراه با آن تجزیه شده باشد. یادداشت مربوط به دستور :keyword:`global` را ببینید."
msgid"The :keyword:`!type` statement"
msgstr"دستور :keyword:`!type`"
msgid"The :keyword:`!type` statement declares a type alias, which is an instance of :class:`typing.TypeAliasType`."
msgstr"دستور :keyword:`!type` یک نام مستعار نوع اعلام میکند، که نمونهای از :class:`typing.TypeAliasType` است."
msgid"For example, the following statement creates a type alias::"
msgstr"برای مثال، دستور زیر یک نام مستعار نوع ایجاد میکند::"
msgid"``annotation-def`` indicates an :ref:`annotation scope <annotation-scopes>`, which behaves mostly like a function, but with several small differences."
msgstr"``annotation-def`` یک :ref:`محدوده حاشیهنویسی (annotation scope) <annotation-scopes>` را نشان میدهد، که بیشتر مانند یک تابع رفتار میکند، اما چند تفاوت کوچک دارد."
msgid"The value of the type alias is evaluated in the annotation scope. It is not evaluated when the type alias is created, but only when the value is accessed through the type alias's :attr:`!__value__` attribute (see :ref:`lazy-evaluation`). This allows the type alias to refer to names that are not yet defined."
msgstr"مقدار نام مستعار نوع در محدوده حاشیهنویسی (annotation scope) ارزیابی میشود. این مقدار در زمان ایجاد نام مستعار نوع ارزیابی نمیشود، بلکه تنها زمانی ارزیابی میشود که به مقدار از طریق ویژگی :attr:`!__value__` نام مستعار نوع دسترسی پیدا شود (به :ref:`lazy-evaluation` مراجعه کنید). این امر به نام مستعار نوع اجازه میدهد که به نامهایی که هنوز تعریف نشدهاند ارجاع دهد."
msgid"Type aliases may be made generic by adding a :ref:`type parameter list <type-params>` after the name. See :ref:`generic-type-aliases` for more."
msgstr"نامهای مستعار نوع میتوانند با افزودن یک :ref:`فهرست پارامترهای نوع <type-params>` پس از نام، عام شوند. برای اطلاعات بیشتر، :ref:`generic-type-aliases` را ببینید."
msgid":keyword:`!type` is a :ref:`soft keyword <soft-keywords>`."
msgstr":keyword:`!type` یک :ref:`کلیدواژه نرم <soft-keywords>` است."
msgid":pep:`695` - Type Parameter Syntax"
msgstr":pep:`695` - سینتکس پارامتر نوع"
msgid"Introduced the :keyword:`!type` statement and syntax for generic classes and functions."
msgstr"دستور :keyword:`!type` و سینتکس کلاسها و توابع عام معرفی شدند."