Repository navigation
Expand file tree
/
Copy pathexpressions.po
More file actions
2732 lines (2042 loc) · 229 KB
/
Copy pathexpressions.po
File metadata and controls
2732 lines (2042 loc) · 229 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Alireza Shabani (Revisto) <theRevisto@gmail.com>, 2025
# Danial Behzadi <dani.behzi@ubuntu.com>, 2025
# Rafael Fontenelle <rffontenelle@gmail.com>, 2025
# Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026
# arman mohebali <armanmohebali@outlook.com>, 2026
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-10-01 14:41+0330\n"
"PO-Revision-Date: 2026-10-06 19:51+0330\n"
"Last-Translator: Sepehr Rasouli <sepehrrasouli06@gmail.com>, 2026\n"
"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 "Expressions"
msgstr "عبارات"
msgid "This chapter explains the meaning of the elements of expressions in Python."
msgstr "این فصل معنای عناصر عبارتها در پایتون را توضیح میدهد."
msgid "**Syntax Notes:** In this and the following chapters, :ref:`grammar notation <notation>` will be used to describe syntax, not lexical analysis."
msgstr "**یادداشتهای سینتکس:** در این فصل و فصلهای پس از آن، از :ref:`نمادگذاری دستور زبان <notation>` برای توصیف سینتکس استفاده خواهد شد، نه برای تحلیل واژگانی."
msgid "When (one alternative of) a syntax rule has the form:"
msgstr "هنگامی که (یکی از جایگزینهای) یک قاعدهی سینتکس به شکل زیر باشد:"
msgid "and no semantics are given, the semantics of this form of ``name`` are the same as for ``othername``."
msgstr "و هیچ معنایی ارائه نشده است، معنای این شکل از ``name`` همان معنای ``othername`` است."
msgid "Arithmetic conversions"
msgstr "تبدیلات حسابی"
msgid "When a description of an arithmetic operator below uses the phrase \"the numeric arguments are converted to a common real type\", this means that the operator implementation for built-in numeric types works as described in the :ref:`Numeric Types <stdtypes-mixed-arithmetic>` section of the standard library documentation."
msgstr "هرگاه در توضیح یک عملگر حسابی در زیر از عبارت «آرگومانهای عددی به یک نوع حقیقی مشترک تبدیل میشوند» استفاده شده باشد، این بدان معناست که پیادهسازی عملگر برای انواع عددی توکار، همانطور که در بخش :ref:`انواع عددی <stdtypes-mixed-arithmetic>` مستندات کتابخانه استاندارد توضیح داده شده است، کار میکند."
msgid "Some additional rules apply for certain operators and non-numeric operands (for example, a string as a left argument to the ``%`` operator). Extensions must define their own conversion behavior."
msgstr "برخی قواعد اضافی برای برخی عملگرها و عملوندهای غیرعددی اعمال میشوند (برای مثال، یک رشته بهعنوان آرگومان سمت چپ عملگر ``%``). افزونهها باید رفتار تبدیل خود را تعریف کنند."
msgid "Atoms"
msgstr "اتمها"
msgid "Atoms are the most basic elements of expressions. The simplest atoms are :ref:`builtin constants <atom-singletons>`, :ref:`names <identifiers>` and :ref:`literals <atom-literals>`. More complex atoms are enclosed in paired delimiters:"
msgstr "اتمها اساسیترین عناصر عبارتها هستند. سادهترین اتمها :ref:`ثابتهای توکار <atom-singletons>`، :ref:`نامها <identifiers>` و :ref:`لیترالها <atom-literals>` هستند. اتمهای پیچیدهتر در درون جفتجداکنندهها قرار میگیرند:"
msgid "``()`` (parentheses): :ref:`groups <parenthesized>`, :ref:`tuple displays <tuple-display>`, :ref:`yield atoms <yieldexpr>`, and :ref:`generator expressions <genexpr>`;"
msgstr "``()`` (پرانتزها): :ref:`گروهها <parenthesized>`، :ref:`نمایشهای تاپل <tuple-display>`، :ref:`اتمهای yield <yieldexpr>` و :ref:`عبارتهای مولد <genexpr>`؛"
msgid "``[]`` (square brackets): :ref:`list displays <lists>`;"
msgstr "``[]`` (براکتها): :ref:`نمایشهای فهرست <lists>`؛"
msgid "``{}`` (curly braces): :ref:`dictionary <dict>` and :ref:`set <set>` displays."
msgstr "``{}`` (آکولادها): نمایشهای :ref:`دیکشنری <dict>` و :ref:`مجموعه <set>`."
msgid "Formally, the syntax for atoms is:"
msgstr "بهطور رسمی، سینتکس اتمها عبارت است از:"
msgid "Built-in constants"
msgstr "ثابتهای توکار"
msgid "The keywords ``True``, ``False``, and ``None`` name :ref:`built-in constants <built-in-consts>`. The token ``...`` names the :py:data:`Ellipsis` constant."
msgstr "کلیدواژههای ``True``، ``False`` و ``None`` نامهای :ref:`ثابتهای توکار <built-in-consts>` هستند. توکن ``...`` نام ثابت :py:data:`Ellipsis` است."
msgid "Evaluation of these atoms yields the corresponding value."
msgstr "ارزیابی این اتمها مقدار متناظر را به دست میدهد."
msgid "Several more built-in constants are available as global variables, but only the ones mentioned here are :ref:`keywords <keywords>`. In particular, these names cannot be reassigned or used as attributes:"
msgstr "چند ثابت توکار دیگر نیز بهعنوان متغیرهای سراسری در دسترس هستند، اما تنها مواردی که در اینجا ذکر شدهاند :ref:`کلیدواژهها <keywords>` هستند. بهویژه، این نامها را نمیتوان دوباره مقداردهی کرد یا بهعنوان ویژگی استفاده کرد:"
msgid ""
">>> False = 123\n"
" File \"<input>\", line 1\n"
" False = 123\n"
" ^^^^^\n"
"SyntaxError: cannot assign to False"
msgstr ""
">>> False = 123\n"
" File \"<input>\", line 1\n"
" False = 123\n"
" ^^^^^\n"
"SyntaxError: cannot assign to False"
msgid "Formally, the syntax for built-in constants is:"
msgstr "بهطور رسمی، نحوه (سینتکس) ثابتهای توکار به این صورت است:"
msgid "Identifiers (Names)"
msgstr "شناسهها (نامها)"
msgid "An identifier occurring as an atom is a name. See section :ref:`identifiers` for lexical definition and section :ref:`naming` for documentation of naming and binding."
msgstr "یک شناسه که بهعنوان یک اتم (atom) ظاهر میشود، یک نام است. بخش :ref:`identifiers` را برای تعریف واژگانی و بخش :ref:`naming` را برای مستندات نامگذاری و پیوند ببینید."
msgid "When the name is bound to an object, evaluation of the atom yields that object. When a name is not bound, an attempt to evaluate it raises a :exc:`NameError` exception."
msgstr "هنگامی که نام به یک شیء مقید شده باشد، ارزیابی اتم، آن شیء را حاصل میکند. هنگامی که نامی مقید نشده باشد، تلاش برای ارزیابی آن، استثنای :exc:`NameError` را پرتاب میکند."
msgid "Private name mangling"
msgstr "تغییر نام خصوصی (private name mangling)"
msgid "When an identifier that textually occurs in a class definition begins with two or more underscore characters and does not end in two or more underscores, it is considered a :dfn:`private name` of that class."
msgstr "هرگاه شناسهای که در متن تعریف یک کلاس آمده باشد با ۲ یا چند نویسه زیرخط آغاز شود و به ۲ یا چند زیرخط ختم نشود، یک :dfn:`نام خصوصی (private name)` برای آن کلاس محسوب میشود."
msgid "The :ref:`class specifications <class>`."
msgstr ":ref:`مشخصات کلاس <class>`."
msgid "More precisely, private names are transformed to a longer form before code is generated for them. If the transformed name is longer than 255 characters, implementation-defined truncation may happen."
msgstr "دقیقتر اینکه، نامهای خصوصی پیش از تولید کد برای آنها به شکل طولانیتری تبدیل میشوند. اگر نام تبدیلشده طولانیتر از ۲۵۵ نویسه باشد، ممکن است کوتاهسازی (truncation) تعریفشده توسط پیادهسازی رخ دهد."
msgid "The transformation is independent of the syntactical context in which the identifier is used but only the following private identifiers are mangled:"
msgstr "این تبدیل مستقل از زمینهی نحویای است که شناسه در آن استفاده میشود، اما تنها شناسههای خصوصی زیر تغییر نام داده میشوند:"
msgid "Any name used as the name of a variable that is assigned or read or any name of an attribute being accessed."
msgstr "هر نامی که بهعنوان نام متغیری استفاده شود که به آن مقدار انتساب داده میشود یا خوانده میشود، یا هر نامی از یک ویژگی که مورد دسترسی قرار میگیرد."
msgid "The :attr:`~definition.__name__` attribute of nested functions, classes, and type aliases is however not mangled."
msgstr "با این حال، ویژگی :attr:`~definition.__name__` در توابع، کلاسها و نامهای مستعار نوع تودرتو تغییر نام نمییابد."
msgid "The name of imported modules, e.g., ``__spam`` in ``import __spam``. If the module is part of a package (i.e., its name contains a dot), the name is *not* mangled, e.g., the ``__foo`` in ``import __foo.bar`` is not mangled."
msgstr "نام ماژولهای ایمپورتشده، برای مثال ``__spam`` در ``import __spam``. اگر ماژول بخشی از یک بسته باشد (یعنی نام آن شامل نقطه باشد)، نام دستکاری *نمیشود*، برای مثال ``__foo`` در ``import __foo.bar`` دستکاری نمیشود."
msgid "The name of an imported member, e.g., ``__f`` in ``from spam import __f``."
msgstr "نام یک عضو ایمپورتشده، مثلاً ``__f`` در ``from spam import __f``."
msgid "The transformation rule is defined as follows:"
msgstr "قاعده تبدیل بهصورت زیر تعریف شده است:"
msgid "The class name, with leading underscores removed and a single leading underscore inserted, is inserted in front of the identifier, e.g., the identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or ``__Foo`` is transformed to ``_Foo__spam``."
msgstr "نام کلاس، پس از حذف زیرسطرهای آغازین و افزودن یک زیرخط در ابتدا، در جلوی شناسه قرار میگیرد؛ برای مثال، شناسهی ``__spam`` که در کلاسی با نام ``Foo``، ``_Foo`` یا ``__Foo`` آمده باشد، به ``_Foo__spam`` تبدیل میشود."
msgid "If the class name consists only of underscores, the transformation is the identity, e.g., the identifier ``__spam`` occurring in a class named ``_`` or ``__`` is left as is."
msgstr "اگر نام کلاس فقط از زیرخط تشکیل شده باشد، تبدیل همانی است؛ برای مثال، شناسهی ``__spam`` که در کلاسی با نام ``_`` یا ``__`` آمده است، بدون تغییر باقی میماند."
msgid "Literals"
msgstr "مقادیر لفظی"
msgid "A :dfn:`literal` is a textual representation of a value. Python supports numeric, string and bytes literals. :ref:`Format strings <f-strings>` and :ref:`template strings <t-strings>` are treated as string literals."
msgstr ":dfn:`لفظی (literal)` نمایشی متنی از یک مقدار است. پایتون از مقادیر لفظی عددی، رشتهای و بایتی پشتیبانی میکند. :ref:`افاسترینگها <f-strings>` و :ref:`رشتههای قالبی <t-strings>` بهعنوان مقادیر لفظی رشتهای در نظر گرفته میشوند."
msgid "Numeric literals consist of a single :token:`NUMBER <python-grammar:NUMBER>` token, which names an integer, floating-point number, or an imaginary number. See the :ref:`numbers` section in Lexical analysis documentation for details."
msgstr "مقادیر لفظی عددی از یک توکن :token:`NUMBER <python-grammar:NUMBER>` تشکیل شدهاند که یک عدد صحیح، عدد ممیز شناور یا عدد موهومی را مشخص میکند. برای جزئیات، بخش :ref:`numbers` را در مستندات تحلیل واژگانی ببینید."
msgid "String and bytes literals may consist of several tokens. See section :ref:`string-concatenation` for details."
msgstr "مقادیر لفظی رشته و بایت ممکن است از چندین توکن تشکیل شده باشند. برای جزئیات، بخش :ref:`string-concatenation` را ببینید."
msgid "Note that negative and complex numbers, like ``-3`` or ``3+4.2j``, are syntactically not literals, but :ref:`unary <unary>` or :ref:`binary <binary>` arithmetic operations involving the ``-`` or ``+`` operator."
msgstr "توجه داشته باشید که اعداد منفی و مختلط، مانند ``-3`` یا ``3+4.2j``، از نظر سینتکسی لفظی نیستند، بلکه عملیات حسابی :ref:`یکعملوندی <unary>` یا :ref:`دوعملوندی <binary>` هستند که شامل عملگر ``-`` یا ``+`` میشوند."
msgid "Evaluation of a literal yields an object of the given type (:class:`int`, :class:`float`, :class:`complex`, :class:`str`, :class:`bytes`, or :class:`~string.templatelib.Template`) with the given value. The value may be approximated in the case of floating-point and imaginary literals."
msgstr "ارزیابی یک لفظی، شیءای از نوع دادهشده (:class:`int`، :class:`float`، :class:`complex`، :class:`str`، :class:`bytes`، یا :class:`~string.templatelib.Template`) با مقدار دادهشده را به دست میدهد. در مورد مقادیر لفظی ممیز شناور و موهومی، ممکن است مقدار تقریبی باشد."
msgid "The formal grammar for literals is:"
msgstr "دستور زبان صوری برای مقادیر لفظی چنین است:"
msgid "Literals and object identity"
msgstr "مقادیر لفظی و هویت شیء"
msgid "All literals correspond to immutable data types, and hence the object's identity is less important than its value. Multiple evaluations of literals with the same value (either the same occurrence in the program text or a different occurrence) may obtain the same object or a different object with the same value."
msgstr "همهی مقادیر لفظی با انواع دادهی تغییرناپذیر متناظر هستند، و از این رو، هویت شیء کماهمیتتر از مقدار آن است. ارزیابیهای متعدد مقادیر لفظیی با مقدار یکسان (چه همان محل در متن برنامه و چه محلی دیگر) ممکن است همان شیء یا شیء متفاوتی با همان مقدار را به دست آورند."
msgid "CPython implementation detail"
msgstr "جزئیات پیادهسازی CPython"
msgid "For example, in CPython, *small* integers with the same value evaluate to the same object::"
msgstr "برای مثال، در CPython، اعداد صحیح *کوچک* با مقدار یکسان، به یک شیء یکسان ارزیابی میشوند::"
msgid ""
">>> x = 7\n"
">>> y = 7\n"
">>> x is y\n"
"True"
msgstr ""
">>> x = 7\n"
">>> y = 7\n"
">>> x is y\n"
"True"
msgid "However, large integers evaluate to different objects::"
msgstr "با این حال، اعداد صحیح بزرگ به اشیاء متفاوتی ارزیابی میشوند::"
msgid ""
">>> x = 123456789\n"
">>> y = 123456789\n"
">>> x is y\n"
"False"
msgstr ""
">>> x = 123456789\n"
">>> y = 123456789\n"
">>> x is y\n"
"False"
msgid "This behavior may change in future versions of CPython. In particular, the boundary between \"small\" and \"large\" integers has already changed in the past."
msgstr "این رفتار ممکن است در نسخههای آینده CPython تغییر کند. بهویژه، مرز بین اعداد صحیح «کوچک» و «بزرگ» پیشتر تغییر کرده است."
msgid "CPython will emit a :py:exc:`SyntaxWarning` when you compare literals using ``is``::"
msgstr "CPython هنگامی که مقادیر لفظی را با استفاده از ``is`` مقایسه میکنید، یک :py:exc:`SyntaxWarning` نشان میدهد::"
msgid ""
">>> x = 7\n"
">>> x is 7\n"
"<input>:1: SyntaxWarning: \"is\" with 'int' literal. Did you mean \"==\"?\n"
"True"
msgstr ""
">>> x = 7\n"
">>> x is 7\n"
"<input>:1: SyntaxWarning: \"is\" with 'int' literal. Did you mean \"==\"?\n"
"True"
msgid "See :ref:`faq-identity-with-is` for more information."
msgstr "برای اطلاعات بیشتر، :ref:`faq-identity-with-is` را ببینید."
msgid ":ref:`Template strings <t-strings>` are immutable but may reference mutable objects as :class:`~string.templatelib.Interpolation` values. For the purposes of this section, two t-strings have the \"same value\" if both their structure and the *identity* of the values match."
msgstr ":ref:`رشتههای الگو <t-strings>` تغییرناپذیر هستند، اما ممکن است به اشیای تغییرپذیر بهعنوان مقادیر :class:`~string.templatelib.Interpolation` ارجاع دهند. برای اهداف این بخش، دو تیاسترینگ «مقدار یکسان» دارند اگر هم ساختار آنها و هم *هویت* مقادیرشان مطابقت داشته باشد."
msgid "Currently, each evaluation of a template string results in a different object."
msgstr "در حال حاضر، هر ارزیابی از یک رشتهی قالب به یک شیء متفاوت منجر میشود."
msgid "String literal concatenation"
msgstr "الحاق رشتههای لفظی"
msgid "Multiple adjacent string or bytes literals, possibly using different quoting conventions, are allowed, and their meaning is the same as their concatenation::"
msgstr "مقادیر لفظی مجاور رشته یا بایت، که ممکن است از قواعد متفاوتی برای علامت نقلقول استفاده کنند، مجاز هستند و معنای آنها همان معنای الحاق آنها است::"
msgid ""
">>> \"hello\" 'world'\n"
"\"helloworld\""
msgstr ""
">>> \"hello\" 'world'\n"
"\"helloworld\""
msgid "This feature is defined at the syntactical level, so it only works with literals. To concatenate string expressions at run time, the '+' operator may be used::"
msgstr "این قابلیت در سطح سینتکس تعریف شده است، بنابراین فقط با مقادیر لفظی کار میکند. برای الحاق عبارات رشتهای در رانتایم، میتوان از عملگر '+' استفاده کرد::"
msgid ""
">>> greeting = \"Hello\"\n"
">>> space = \" \"\n"
">>> name = \"Blaise\"\n"
">>> print(greeting + space + name) # not: print(greeting space name)\n"
"Hello Blaise"
msgstr ""
">>> greeting = \"Hello\"\n"
">>> space = \" \"\n"
">>> name = \"Blaise\"\n"
">>> print(greeting + space + name) # not: print(greeting space name)\n"
"Hello Blaise"
msgid "Literal concatenation can freely mix raw strings, triple-quoted strings, and formatted string literals. For example::"
msgstr "در الحاق لفظی میتوان آزادانه رشتههای خام، رشتههای سهنقلقولی و مقادیر لفظی رشتهای قالببندیشده را با هم ترکیب کرد. برای مثال::"
msgid ""
">>> \"Hello\" r', ' f\"{name}!\"\n"
"\"Hello, Blaise!\""
msgstr ""
">>> \"Hello\" r', ' f\"{name}!\"\n"
"\"Hello, Blaise!\""
msgid "This feature can be used to reduce the number of backslashes needed, to split long strings conveniently across long lines, or even to add comments to parts of strings. For example::"
msgstr "میتوان از این قابلیت برای کاهش تعداد بکاسلشهای مورد نیاز، تقسیم راحت رشتههای طولانی در سطرهای طولانی، یا حتی افزودن کامنت به بخشهایی از رشتهها استفاده کرد. برای مثال::"
msgid ""
"re.compile(\"[A-Za-z_]\" # letter or underscore\n"
" \"[A-Za-z0-9_]*\" # letter, digit or underscore\n"
" )"
msgstr ""
"re.compile(\"[A-Za-z_]\" # letter or underscore\n"
" \"[A-Za-z0-9_]*\" # letter, digit or underscore\n"
" )"
msgid "However, bytes literals may only be combined with other byte literals; not with string literals of any kind. Also, template string literals may only be combined with other template string literals::"
msgstr "با این حال، مقادیر لفظی بایت فقط میتوانند با دیگر مقادیر لفظی بایت ترکیب شوند؛ نه با مقادیر لفظی رشته از هیچ نوعی. همچنین، مقادیر لفظی رشته قالب فقط میتوانند با دیگر مقادیر لفظی رشته قالب ترکیب شوند::"
msgid ""
">>> t\"Hello\" t\"{name}!\"\n"
"Template(strings=('Hello', '!'), interpolations=(...))"
msgstr ""
">>> t\"Hello\" t\"{name}!\"\n"
"Template(strings=('Hello', '!'), interpolations=(...))"
msgid "Formally:"
msgstr "بهطور رسمی:"
msgid "Parenthesized groups"
msgstr "گروههای پرانتزگذاریشده"
msgid "A :dfn:`parenthesized group` is an expression enclosed in parentheses. The group evaluates to the same value as the expression inside."
msgstr "یک :dfn:`گروه پرانتزدار` عبارتی است که در پرانتز محصور شده است. این گروه به همان مقداری ارزیابی میشود که عبارت درون آن ارزیابی میشود."
msgid "Groups are used to override or clarify :ref:`operator precedence <operator-precedence>`, in the same way as in math notation. For example::"
msgstr "گروهها برای لغو یا شفافسازی :ref:`تقدم عملگر <operator-precedence>`، به همان روش نمادگذاری ریاضی استفاده میشوند. برای مثال::"
msgid ""
">>> 3 << 2 | 4\n"
"12\n"
">>> 3 << (2 | 4) # Override precedence of the | (bitwise OR)\n"
"192\n"
">>> (3 << 2) | 4 # Same as without parentheses (but more clear)\n"
"12"
msgstr ""
">>> 3 << 2 | 4\n"
"12\n"
">>> 3 << (2 | 4) # Override precedence of the | (bitwise OR)\n"
"192\n"
">>> (3 << 2) | 4 # Same as without parentheses (but more clear)\n"
"12"
msgid "Note that not everything in parentheses is a *group*. Specifically, a parenthesized group must include exactly one expression, and cannot end with a comma. See :ref:`tuple displays <tuple-display>` and :ref:`generator expressions <genexpr>` for other parenthesized forms."
msgstr "توجه داشته باشید که هر چیزی که در پرانتز قرار دارد یک *گروه* نیست. بهطور مشخص، یک گروه پرانتزدار باید دقیقا شامل یک عبارت باشد و نمیتواند با کاما پایان یابد. برای سایر اشکال پرانتزدار به :ref:`نمایشهای تاپل <tuple-display>` و :ref:`عبارتهای مولد <genexpr>` مراجعه کنید."
msgid "Formally, the syntax for groups is:"
msgstr "بهطور رسمی، نحوه (سینتکس) گروهها به این صورت است:"
msgid "Container displays"
msgstr "نمایشهای ظروف"
msgid "For constructing builtin containers (lists, sets, tuples or dictionaries), Python provides special syntax called :dfn:`displays`. There are subtle differences between the four kinds of displays, detailed in the following sections. All displays, however, consist of comma-separated items enclosed in paired delimiters."
msgstr "پایتون برای ساخت ظروف توکار (فهرستها، مجموعهها، تاپلها یا دیکشنریها)، نحو ویژهای به نام :dfn:`نمایشها` (displays) فراهم میکند. تفاوتهای ظریفی بین این چهار نوع نمایش وجود دارد که در بخشهای زیر به تفصیل شرح داده شده است. با این حال، همه نمایشها از آیتمهای جدا شده با کاما تشکیل شدهاند که در جداکنندههای جفتشده محصور شدهاند."
msgid "For example, a *list display* is a series of expressions enclosed in square brackets::"
msgstr "برای نمونه، یک *نمایش فهرست* (list display) مجموعهای از عبارتها است که در داخل کروشهها قرار گرفتهاند::"
msgid ""
">>> [\"one\", \"two\", \"three\"]\n"
"['one', 'two', 'three']\n"
">>> [1 + 2, 2 + 3]\n"
"[3, 5]"
msgstr ""
">>> [\"one\", \"two\", \"three\"]\n"
"['one', 'two', 'three']\n"
">>> [1 + 2, 2 + 3]\n"
"[3, 5]"
msgid "In list, tuple and dictionary (but not set) displays, the series may be empty::"
msgstr "در نمایشهای فهرست، تاپل و دیکشنری (اما نه مجموعه)، دنباله میتواند خالی باشد::"
msgid ""
">>> [] # empty list\n"
"[]\n"
">>> () # empty tuple\n"
"()\n"
">>> {} # empty dictionary\n"
"{}"
msgstr ""
">>> [] # empty list\n"
"[]\n"
">>> () # empty tuple\n"
"()\n"
">>> {} # empty dictionary\n"
"{}"
msgid "If the series is not empty, the items may be followed by an additional comma, which has no effect::"
msgstr "اگر سری خالی نباشد، پس از آیتمها میتوان از یک ویرگول اضافی استفاده کرد که هیچ تأثیری ندارد::"
msgid ""
">>> [\"one\", \"two\", \"three\",] # note comma after \"three\"\n"
"['one', 'two', 'three']"
msgstr ""
">>> [\"one\", \"two\", \"three\",] # note comma after \"three\"\n"
"['one', 'two', 'three']"
msgid "The trailing comma is often used for displays that span multiple lines (using :ref:`implicit line joining <implicit-joining>`), so when a future programmer adds a new entry at the end, they do not need to modify an existing line::"
msgstr "ویرگول پایانی اغلب برای نمایشهایی استفاده میشود که چندین سطر را در بر میگیرند (با استفاده از :ref:`implicit line joining <implicit-joining>`)؛ بنابراین وقتی برنامهنویس آیندهای در انتهای آن ورودی جدیدی اضافه میکند، نیازی به تغییر سطر موجود ندارد::"
msgid ""
">>> [\n"
"... 'one',\n"
"... 'two',\n"
"... 'three',\n"
"... ]\n"
"['one', 'two', 'three']"
msgstr ""
">>> [\n"
"... 'one',\n"
"... 'two',\n"
"... 'three',\n"
"... ]\n"
"['one', 'two', 'three']"
msgid "At runtime, when a display is evaluated, the listed items are evaluated from left to right and placed into a new container of the appropriate type."
msgstr "در زمان رانتایم، هنگامی که یک نمایش ارزیابی میشود، آیتمهای فهرستشده از چپ به راست ارزیابی شده و در ظرف جدیدی از نوع مناسب قرار میگیرند."
msgid "For tuple, list and set (but not dict) displays, any item in the display may be prefixed with an asterisk (``*``). This denotes :ref:`iterable unpacking <iterable-unpacking>`. At runtime, the asterisk-prefixed expression must evaluate to an iterable, whose contents are inserted into the container at the location of the unpacking. For example::"
msgstr "برای نمایشهای تاپل، فهرست و مجموعه (اما نه دیکشنری)، هر آیتمی در نمایش میتواند پیشوندی با یک ستاره (``*``) داشته باشد. این موضوع نشاندهندهی :ref:`iterable unpacking <iterable-unpacking>` است. در زمان رانتایم، عبارتِ پیشوندگرفته با ستاره باید به یک پیمایشپذیر ارزیابی شود که محتویات آن در محل بازکردن بسته در ظرف درج میشوند. برای مثال::"
msgid ""
">>> numbers = (1, 2)\n"
">>> [*numbers, 'word', *numbers]\n"
"[1, 2, 'word', 1, 2]"
msgstr ""
">>> numbers = (1, 2)\n"
">>> [*numbers, 'word', *numbers]\n"
"[1, 2, 'word', 1, 2]"
msgid "Dictionary displays use a similar mechanism called *dictionary unpacking*, denoted with a double asterisk (``**``). See :ref:`dict` for details."
msgstr "نمایشهای دیکشنری از مکانیسم مشابهای به نام *بازکردن بستهی دیکشنری* استفاده میکنند که با دو ستاره (``**``) مشخص میشود. برای جزئیات بیشتر :ref:`dict` را ببینید."
msgid "A more advanced form of displays are :dfn:`comprehensions`, where items are computed via a set of looping and filtering instructions. See the :ref:`comprehensions` section for details."
msgstr "نوع پیشرفتهتری از نمایشها، :dfn:`درکها` هستند که در آنها آیتمها از طریق مجموعهای از دستورات حلقهای و فیلترینگ محاسبه میشوند. برای جزئیات، بخش :ref:`comprehensions` را ببینید."
msgid "Iterable and dictionary unpacking in displays, originally proposed by :pep:`448`."
msgstr "پیمایشپذیر و بازکردن بستهی دیکشنری در نمایشها که ابتدا توسط :pep:`448` پیشنهاد شد."
msgid "List displays"
msgstr "نمایشهای فهرست"
msgid "A :dfn:`list display` is a possibly empty series of expressions enclosed in square brackets. For example::"
msgstr "یک :dfn:`نمایش فهرست` (list display) دنبالهای احتمالاً خالی از عبارتها است که در داخل کروشهها قرار دارد. برای نمونه::"
msgid ""
">>> [\"one\", \"two\", \"three\"]\n"
"['one', 'two', 'three']\n"
">>> [\"one\"] # One-element list\n"
"['one']\n"
">>> [] # empty list\n"
"[]"
msgstr ""
">>> [\"one\", \"two\", \"three\"]\n"
"['one', 'two', 'three']\n"
">>> [\"one\"] # One-element list\n"
"['one']\n"
">>> [] # empty list\n"
"[]"
msgid "See :ref:`displays` for general information on displays."
msgstr "برای اطلاعات عمومی دربارهی نمایشها، :ref:`displays` را ببینید."
msgid "The formal grammar for list displays is:"
msgstr "گرامر رسمی نمایشهای فهرست عبارت است از:"
msgid "Set displays"
msgstr "نمایشهای مجموعه"
msgid "A :dfn:`set display` is a *non-empty* series of expressions enclosed in curly braces. For example::"
msgstr "یک :dfn:`نمایش مجموعه` (set display) دنبالهای *غیرخالی* از عبارتها است که در داخل آکولادها قرار دارد. برای نمونه::"
msgid ""
">>> {\"one\", \"two\", \"three\"}\n"
"{'one', 'three', 'two'}\n"
">>> {\"one\"} # One-element set\n"
"{'one'}"
msgstr ""
">>> {\"one\", \"two\", \"three\"}\n"
"{'one', 'three', 'two'}\n"
">>> {\"one\"} # One-element set\n"
"{'one'}"
msgid "There is no special syntax for the empty set. The ``{}`` literal is a :ref:`dictionary display <dict>` that constructs an empty dictionary. Call :class:`set() <set>` with no arguments to get an empty set."
msgstr "هیچ نحو خاصی برای مجموعهی خالی وجود ندارد. لفظی ``{}`` یک :ref:`dictionary display <dict>` است که یک دیکشنری خالی میسازد. برای دریافت یک مجموعهی خالی، :class:`set() <set>` را بدون هیچ آرگومانی فراخوانی کنید."
msgid "The formal grammar for set displays is:"
msgstr "گرامر رسمی نمایشهای مجموعه عبارت است از:"
msgid "Tuple displays"
msgstr "نمایشهای تاپل"
msgid "A :dfn:`tuple display` is a series of expressions enclosed in parentheses. For example::"
msgstr "یک :dfn:`نمایش تاپل` (tuple display) دنبالهای از عبارتها است که در داخل پرانتزها قرار دارد. برای نمونه::"
msgid ""
">>> (1, 2)\n"
"(1, 2)\n"
">>> () # an empty tuple\n"
"()"
msgstr ""
">>> (1, 2)\n"
"(1, 2)\n"
">>> () # an empty tuple\n"
"()"
msgid "To avoid ambiguity, if a tuple display has exactly one element, it requires a trailing comma. Without it, you get a :ref:`parenthesized group <parenthesized>`::"
msgstr "برای جلوگیری از ابهام، اگر یک نمایش تاپل دقیقاً یک عنصر داشته باشد، به یک ویرگول پایانی نیاز دارد. بدون آن، یک :ref:`parenthesized group <parenthesized>` دریافت میکنید::"
msgid ""
">>> ('single',) # single-element tuple\n"
"('single',)\n"
">>> ('single') # no comma: single string\n"
"'single'"
msgstr ""
">>> ('single',) # single-element tuple\n"
"('single',)\n"
">>> ('single') # no comma: single string\n"
"'single'"
msgid "To put it in other words, a tuple display is a parenthesized list of either:"
msgstr "به عبارت دیگر، نمایش تاپل فهرستی است از موارد زیر که داخل پرانتز قرار گرفتهاند:"
msgid "two or more comma-separated expressions, or"
msgstr "دو یا چند عبارت جداشده با کاما، یا"
msgid "zero or more expressions, each followed by a comma."
msgstr "صفر یا چند عبارت که هر کدام با یک ویرگول دنبال میشوند."
msgid "Since tuples are immutable, :ref:`object identity rules for literals <literals-identity>` also apply to tuples: at runtime, two occurrences of tuples with the same values may or may not yield the same object."
msgstr "از آنجایی که تاپلها تغییرناپذیر هستند، :ref:`قوانین هویت شیء برای مقادیر ثابت <literals-identity>` نیز در مورد تاپلها اعمال میشوند: در رانتایم، دو وقوع از تاپلها با مقادیر یکسان ممکن است شیء یکسانی را تولید کنند یا نکنند."
msgid "Python's syntax also includes :ref:`expression lists <exprlists>`, where a comma-separated list of expressions is *not* enclosed in parentheses but evaluates to tuple."
msgstr "نحو پایتون همچنین شامل :ref:`expression lists <exprlists>` است که در آن فهرستی از عباراتِ جداشده با ویرگول در پرانتز قرار *نمیگیرند* اما به یک تاپل ارزیابی میشوند."
msgid "In other words, when it comes to tuple syntax, the comma is more important that the use of parentheses. Only the empty tuple is spelled without a comma."
msgstr "به عبارت دیگر، هنگامی که صحبت از نحو تاپل به میان میآید، ویرگول مهمتر از استفاده از پرانتز است. فقط تاپل خالی بدون ویرگول نوشته میشود."
msgid "The formal grammar for tuple displays is:"
msgstr "گرامر رسمی برای نمایشهای تاپل عبارت است از:"
msgid "Dictionary displays"
msgstr "نمایشهای دیکشنری"
msgid "A :dfn:`dictionary display` is a possibly empty series of :dfn:`dict items` enclosed in curly braces. Each dict item is a colon-separated pair of expressions: the :dfn:`key` and its associated :dfn:`value`. For example::"
msgstr "یک :dfn:`dictionary display` سری احتمالاً خالی از :dfn:`dict items` است که درون آکولاد قرار گرفتهاند. هر آیتم دیکشنری یک جفت عبارتِ جداشده با دونقطه است: :dfn:`key` و :dfn:`value` مرتبط با آن. برای مثال::"
msgid ""
">>> {1: 'one', 2: 'two'}\n"
"{1: 'one', 2: 'two'}"
msgstr ""
">>> {1: 'one', 2: 'two'}\n"
"{1: 'one', 2: 'two'}"
msgid "At runtime, when a dictionary comprehension is evaluated, the expressions are evaluated from left to right. Each key object is used as a key into the dictionary to store the corresponding value. This means that you can specify the same key multiple times in the comprehension, and the final dictionary's value for a given key will be the last one given. For example::"
msgstr "در رانتایم، هنگام ارزیابی یک درک دیکشنری، عبارتها از چپ به راست ارزیابی میشوند. هر شیء کلید به عنوان کلیدی در دیکشنری برای ذخیرهی مقدار متناظر استفاده میشود. این بدان معناست که شما میتوانید یک کلید را چندین بار در درک مشخص کنید و مقدار دیکشنری نهایی برای یک کلید مشخص، آخرین مقداری خواهد بود که داده شده است. برای مثال::"
msgid ""
">>> {\n"
"... 1: 'this will be overridden',\n"
"... 2: 'two',\n"
"... 1: 'also overridden',\n"
"... 1: 'one',\n"
"... }\n"
"{1: 'one', 2: 'two'}"
msgstr ""
">>> {\n"
"... 1: 'this will be overridden',\n"
"... 2: 'two',\n"
"... 1: 'also overridden',\n"
"... 1: 'one',\n"
"... }\n"
"{1: 'one', 2: 'two'}"
msgid "Instead of a key-value pair, a dict item may be an expression prefixed by a double asterisk ``**``. This denotes :dfn:`dictionary unpacking`. At runtime, the expression must evaluate to a :term:`mapping`; each item of the mapping is added to the new dictionary. As with key-value pairs, later values replace values already set by earlier items and unpackings. This may be used to override a set of defaults::"
msgstr "بهجای جفت کلید-مقدار، یک آیتم دیکشنری ممکن است عبارتی باشد که با دو ستاره ``**`` پیشوند شده است. این نشاندهندهی :dfn:`بازکردن بسته دیکشنری` است. در رانتایم، عبارت باید به یک :term:`نگاشت <mapping>` ارزیابی شود؛ هر آیتم از نگاشت به دیکشنری جدید اضافه میشود. همانند جفتهای کلید-مقدار، مقادیر بعدی جایگزین مقادیری میشوند که قبلاً توسط آیتمها و بازکردن بستههای قبلی تنظیم شدهاند. این ممکن است برای بازنویسی مجموعهای از مقادیر پیشفرض استفاده شود::"
msgid ""
">>> defaults = {'color': 'blue', 'count': 8}\n"
">>> overrides = {'color': 'yellow'}\n"
">>> {**defaults, **overrides}\n"
"{'color': 'yellow', 'count': 8}"
msgstr ""
">>> defaults = {'color': 'blue', 'count': 8}\n"
">>> overrides = {'color': 'yellow'}\n"
">>> {**defaults, **overrides}\n"
"{'color': 'yellow', 'count': 8}"
msgid "Unpacking into dictionary displays, originally proposed by :pep:`448`."
msgstr "واگشایی در نمایشهای دیکشنری، که در ابتدا در :pep:`448` پیشنهاد شده بود."
msgid "The formal grammar for dict displays is:"
msgstr "گرامر رسمی برای نمایشهای دیکشنری عبارت است از:"
msgid "Comprehensions"
msgstr "درکها"
msgid "List, set and dictionary :dfn:`comprehensions` are a form of :ref:`container displays <displays>` where items are computed via a set of looping and filtering instructions rather than listed explicitly."
msgstr ":dfn:`درککنندههای` فهرست، مجموعه و دیکشنری فرمی از :ref:`نمایشهای ظرف <displays>` هستند که در آنها آیتمها به جای فهرستشدن صریح، از طریق مجموعهای از دستورالعملهای حلقهزنی و فیلترینگ محاسبه میشوند."
msgid "In its simplest form, a comprehension consists of a single expression followed by a :keyword:`!for` clause. The :keyword:`!for` clause has the same syntax as the header of a :ref:`for statement <for>`, without a trailing colon."
msgstr "در سادهترین شکل، یک درککننده شامل یک عبارت واحد است که پس از آن یک بند :keyword:`!for` قرار دارد. بند :keyword:`!for` دارای همان نحو (سینتکس) سرآیند یک :ref:`دستور for <for>` است، بدون اینکه دونقطه در انتهای آن قرار گیرد."
msgid "For example, a list of the first ten squares is::"
msgstr "برای مثال، فهرستی از ده مربع اول بهصورت زیر است::"
msgid ""
">>> [x**2 for x in range(10)]\n"
"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]"
msgstr ""
">>> [x**2 for x in range(10)]\n"
"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]"
msgid "At run time, a list comprehension creates a new list. The expression after :keyword:`!in` must evaluate to an :term:`iterable`. For each element of this iterable, the element is bound to the :keyword:`!for` clause's target as in a :keyword:`!for` statement, then the expression before :keyword:`!for` is evaluated with the target in scope and the result is added to the new list. Thus, the example above is roughly equivalent to defining and calling the following function::"
msgstr "در زمان اجرا، یک درک فهرستی یک فهرست جدید ایجاد میکند. عبارت پس از :keyword:`!in` باید به یک :term:`پیمایشپذیر <iterable>` ارزیابی شود. برای هر عنصر از این پیمایشپذیر، عنصر به هدف بند :keyword:`!for` مانند یک دستور :keyword:`!for` متصل میشود، سپس عبارت قبل از :keyword:`!for` با هدف در محدوده ارزیابی میشود و نتیجه به فهرست جدید اضافه میشود. بنابراین، مثال بالا تقریباً معادل تعریف و فراخوانی تابع زیر است::"
msgid ""
"def make_list_of_squares(iterable):\n"
" result = []\n"
" for x in iterable:\n"
" result.append(x**2)\n"
" return result\n"
"\n"
"make_list_of_squares(range(10))"
msgstr ""
"def make_list_of_squares(iterable):\n"
" result = []\n"
" for x in iterable:\n"
" result.append(x**2)\n"
" return result\n"
"\n"
"make_list_of_squares(range(10))"
msgid "Set comprehensions work similarly. For example, here is a set of lowercase letters::"
msgstr "درکهای مجموعه نیز به همین صورت کار میکنند. برای مثال، این هم مجموعهای از حروف کوچک است::"
msgid ""
">>> {x.lower() for x in ['a', 'A', 'b', 'C']}\n"
"{'c', 'a', 'b'}"
msgstr ""
">>> {x.lower() for x in ['a', 'A', 'b', 'C']}\n"
"{'c', 'a', 'b'}"
msgid "At run time, this corresponds roughly to calling this function::"
msgstr "در زمان اجرا، این کار تقریباً معادل فراخوانی این تابع است::"
msgid ""
"def make_lowercase_set(iterable):\n"
" result = set(iterable)\n"
" for x in iterable:\n"
" result.append(x.lower())\n"
" return result\n"
"\n"
"make_lowercase_set(['a', 'A', 'b', 'C'])"
msgstr ""
"def make_lowercase_set(iterable):\n"
" result = set(iterable)\n"
" for x in iterable:\n"
" result.append(x.lower())\n"
" return result\n"
"\n"
"make_lowercase_set(['a', 'A', 'b', 'C'])"
msgid "Dictionary comprehensions start with a colon-separated key-value pair instead of an expression. For example::"
msgstr "درکهای دیکشنری به جای یک عبارت، با یک جفت کلید-مقدار جدا شده با دونقطه شروع میشوند. برای مثال::"
msgid ""
">>> {func.__name__: func for func in [print, hex, any]}\n"
"{'print': <built-in function print>,\n"
" 'hex': <built-in function hex>,\n"
" 'any': <built-in function any>}"
msgstr ""
">>> {func.__name__: func for func in [print, hex, any]}\n"
"{'print': <built-in function print>,\n"
" 'hex': <built-in function hex>,\n"
" 'any': <built-in function any>}"
msgid "At run time, this corresponds roughly to::"
msgstr "در زمان اجرا، این تقریباً معادل موارد زیر است::"
msgid ""
"def make_dict_mapping_names_to_functions(iterable):\n"
" result = {}\n"
" for func in iterable:\n"
" result[func.__name__] = func\n"
" return result\n"
"\n"
"iterable([print, hex, any])"
msgstr ""
"def make_dict_mapping_names_to_functions(iterable):\n"
" result = {}\n"
" for func in iterable:\n"
" result[func.__name__] = func\n"
" return result\n"
"\n"
"iterable([print, hex, any])"
msgid "As in other kinds of dictionary displays, the same key may be specified multiple times. Earlier values are overwritten by ones that are evaluated later."
msgstr "مانند سایر انواع نمایشهای دیکشنری، ممکن است یک کلید چندین بار مشخص شود. مقادیر قبلی توسط مقادیری که بعدها ارزیابی میشوند، بازنویسی میشوند."
msgid "There are no *tuple comprehensions*. A similar syntax is instead used for :ref:`generator expressions <genexpr>`, from which you can construct a tuple like this::"
msgstr "چیزی به نام *درک تاپل* وجود ندارد. در عوض، نحو مشابهی برای :ref:`عبارتهای مولد <genexpr>` استفاده میشود که از طریق آنها میتوانید یک تاپل را به این شکل بسازید::"
msgid ""
">>> tuple(x**2 for x in range(10))\n"
"(0, 1, 4, 9, 16, 25, 36, 49, 64, 81)"
msgstr ""
">>> tuple(x**2 for x in range(10))\n"
"(0, 1, 4, 9, 16, 25, 36, 49, 64, 81)"
msgid "Prior to Python 3.8, in dict comprehensions, the evaluation order of key and value was not well-defined. In CPython, the value was evaluated before the key. Starting with 3.8, the key is evaluated before the value, as proposed by :pep:`572`."
msgstr "پیش از پایتون 3.8، در درک دیکشنری، ترتیب ارزیابی کلید و مقدار بهخوبی تعریفنشده بود. در CPython، مقدار پیش از کلید ارزیابی میشد. از 3.8 به بعد، کلید پیش از مقدار ارزیابی میشود، همانطور که در :pep:`572` پیشنهاد شده است."
msgid "Filtering in comprehensions"
msgstr "فیلتر کردن در درکها"
msgid "The :keyword:`!for` clause may be followed by an :keyword:`!if` clause with an expression."
msgstr "ممکن است پس از بند :keyword:`!for` یک بند :keyword:`!if` همراه با یک عبارت بیاید."
msgid "For example, a list of names from the :mod:`math` module that start with ``f`` is::"
msgstr "برای مثال، فهرستی از نامهای ماژول :mod:`math` که با ``f`` شروع میشوند عبارت است از::"
msgid ""
">>> [name for name in vars(math) if name.startswith('f')]\n"
"['fabs', 'factorial', 'floor', 'fma', 'fmod', 'frexp', 'fsum']"
msgstr ""
">>> [name for name in vars(math) if name.startswith('f')]\n"
"['fabs', 'factorial', 'floor', 'fma', 'fmod', 'frexp', 'fsum']"
msgid "At run time, the expression after :keyword:`!if` is evaluated before each element is added to the resulting container, and if it is false, the element is skipped. Thus, the above example roughly corresponds to defining and calling the following function::"
msgstr "در زمان اجرا، عبارت موجود پس از :keyword:`!if` پیش از اضافه شدن هر المان به ظرف حاصل ارزیابی میشود و اگر نادرست باشد، آن المان نادیده گرفته میشود. بنابراین، مثال بالا تقریباً با تعریف و فراخوانی تابع زیر مطابقت دارد::"
msgid ""
"def get_math_f_names(iterable):\n"
" result = []\n"
" for name in iterable:\n"
" if name.startswith('f'):\n"
" result.append(name)\n"
" return result\n"
"\n"
"get_math_f_names(vars(math))"
msgstr ""
"def get_math_f_names(iterable):\n"
" result = []\n"
" for name in iterable:\n"
" if name.startswith('f'):\n"
" result.append(name)\n"
" return result\n"
"\n"
"get_math_f_names(vars(math))"
msgid "Filtering is a special case of more complex comprehensions. See the next section for a more formal description."
msgstr "فیلترکردن حالت خاصی از درکهای پیچیدهتر است. برای توضیحات رسمیتر، بخش بعدی را ببینید."
msgid "Complex comprehensions"
msgstr "درکهای پیچیده"
msgid "Generally, a comprehension's initial :keyword:`!for` clause may be followed by zero or more additional :keyword:`!for` or :keyword:`!if` clauses. For example, here is a list of names exposed by two Python modules, filtered to only include names that start with ``a``::"
msgstr "بهطور کلی، بند اول :keyword:`!for` در یک درک ممکن است با صفر یا چند بند اضافی :keyword:`!for` یا :keyword:`!if` دنبال شود. برای مثال، در اینجا فهرستی از نامهای عرضهشده توسط دو ماژول پایتون آورده شده است که فیلتر شدهاند تا فقط نامهای شروعشونده با ``a`` را شامل شوند::"
msgid ""
">>> import array\n"
">>> import math\n"
">>> [\n"
"... name\n"
"... for module in [array, math]\n"
"... for name in vars(module)\n"
"... if name.startswith('a')\n"
"... ]\n"
"['array', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh']"
msgstr ""
">>> import array\n"
">>> import math\n"
">>> [\n"
"... name\n"
"... for module in [array, math]\n"
"... for name in vars(module)\n"
"... if name.startswith('a')\n"
"... ]\n"
"['array', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh']"
msgid "At run time, this roughly corresponds to defining and calling::"
msgstr "در زمان اجرا، این مورد تقریباً با تعریف و فراخوانی زیر مطابقت دارد::"
msgid ""
"def get_a_names(iterable):\n"
" result = []\n"
" for module in iterable:\n"
" for name in vars(module):\n"
" if name.startswith('a'):\n"
" result.append(name)\n"
" return result\n"
"\n"
"get_a_names([array, math])"
msgstr ""
"def get_a_names(iterable):\n"
" result = []\n"
" for module in iterable:\n"
" for name in vars(module):\n"
" if name.startswith('a'):\n"
" result.append(name)\n"
" return result\n"
"\n"
"get_a_names([array, math])"
msgid "The elements of the new container are those that would be produced by considering each of the :keyword:`!for` or :keyword:`!if` clauses a block, nesting from left to right, and evaluating the expression to produce an element (or dictionary entry) each time the innermost block is reached."
msgstr "عناصر ظرف جدید آنهایی هستند که با در نظر گرفتن هر یک از بندهای :keyword:`!for` یا :keyword:`!if` به عنوان یک بلوک، تودرتو کردن از چپ به راست، و ارزیابی عبارت برای تولید یک عنصر (یا ورودی دیکشنری) در هر بار رسیدن به داخلیترین بلوک، تولید میشوند."
msgid "Aside from the iterable expression in the leftmost :keyword:`!for` clause, the comprehension is executed in a separate implicitly nested scope. This ensures that names assigned to in the target list don't \"leak\" into the enclosing scope. For example::"
msgstr "بهجز عبارت پیمایشپذیر در سمت چپترین بند :keyword:`!for`، درک در یک محدودهی تودرتوی ضمنی جداگانه اجرا میشود. این تضمین میکند که نامهای تخصیصیافته در فهرست هدف به محدودهی احاطهکننده «نشت» نکنند. برای مثال::"
msgid ""
">>> x = 'old value'\n"
">>> [x**2 for x in range(10)] # this `x` is local to the comprehension\n"
">>> x\n"
"'old value'"
msgstr ""
">>> x = 'old value'\n"
">>> [x**2 for x in range(10)] # این `x` نسبت به درک محلی است\n"
">>> x\n"
"'old value'"
msgid "The iterable expression in the leftmost :keyword:`!for` clause is evaluated directly in the enclosing scope and then passed as an argument to the implicitly nested scope."
msgstr "عبارت پیمایشپذیر در سمت چپترین بند :keyword:`!for` مستقیماً در محدودهی احاطهکننده ارزیابی شده و سپس به عنوان آرگومانی به محدودهی تودرتوی ضمنی ارسال میشود."
msgid "Subsequent :keyword:`!for` clauses and any filter condition in the leftmost :keyword:`!for` clause cannot be evaluated in the enclosing scope as they may depend on the values obtained from the leftmost iterable."
msgstr "بندهای بعدی :keyword:`!for` و هر شرط فیلتری در سمت چپترین بند :keyword:`!for` نمیتوانند در محدودهی احاطهکننده ارزیابی شوند زیرا ممکن است به مقادیر بهدستآآمده از پیمایشپذیر سمت چپ بستگی داشته باشند."
msgid "To ensure the comprehension always results in a container of the appropriate type, ``yield`` and ``yield from`` expressions are prohibited in the implicitly nested scope."
msgstr "برای اطمینان از اینکه درک همیشه به ظرفی از نوع مناسب منجر میشود، عبارتهای ``yield`` و ``yield from`` در محدودهی تودرتوی ضمنی ممنوع هستند."
msgid ":ref:`Assignment expressions <assignment-expressions>` are not allowed inside comprehension iterable expressions (that is, the expressions after the :keyword:`!in` keyword), nor anywhere within comprehensions that appear directly in a class definition."
msgstr ":ref:`عبارتهای انتساب <assignment-expressions>` در عبارتهای پیمایشپذیر درک (یعنی عبارتهای بعد از کلیدواژهین :keyword:`!in`) و همچنین در هیچیک از درکهایی که مستقیماً در تعریف یک کلاس ظاهر میشوند، مجاز نیستند."
msgid "``yield`` and ``yield from`` prohibited in the implicitly nested scope."
msgstr "``yield`` و ``yield from`` در محدودهی تودرتوی ضمنی ممنوع است."
msgid "Unpacking in comprehensions"
msgstr "بازکردن بسته در درکها"
msgid "If the expression of a list or set comprehension is starred, the result will be :ref:`unpacked <iterable-unpacking>` to produce zero or more elements."
msgstr "اگر عبارت یک فهرست یا درک مجموعه ستارهدار باشد، نتیجه :ref:`بازنشود <iterable-unpacking>` تا صفر یا چند عنصر تولید کند."
msgid "This is often used for \"flattening\" lists, for example::"
msgstr "این کار اغلب برای «تختسازی» فهرستها استفاده میشود، برای مثال::"
msgid ""
">>> students = ['Petr', 'Blaise', 'Jarka']\n"
">>> teachers = ['Salim', 'Bartosz']\n"
">>> lists_of_people = [students, teachers]\n"
">>> [*people for people in lists_of_people]\n"
"['Petr', 'Blaise', 'Jarka', 'Salim', 'Bartosz']"
msgstr ""
">>> students = ['Petr', 'Blaise', 'Jarka']\n"
">>> teachers = ['Salim', 'Bartosz']\n"
">>> lists_of_people = [students, teachers]\n"
">>> [*people for people in lists_of_people]\n"
"['Petr', 'Blaise', 'Jarka', 'Salim', 'Bartosz']"
msgid "At run time, this comprehension roughly corresponds to::"
msgstr "در زمان اجرا، این درک تقریباً با موارد زیر مطابقت دارد::"
msgid ""
"def flatten_names(lists_of_people):\n"
" result = []\n"
" for people in lists_of_people:\n"
" result.extend(people)\n"
" return result"
msgstr ""
"def flatten_names(lists_of_people):\n"
" result = []\n"
" for people in lists_of_people:\n"
" result.extend(people)\n"
" return result"
msgid "In dict comprehensions, a double-starred expression will be evaluated and then unpacked using :ref:`dictionary unpacking <dict-unpacking>`, inserting zero or more key/value pairs into the new dictionary. As in other kinds of dictionary displays, if the same key is specified multiple times, the associated value in the resulting dictionary will be the last one specified."
msgstr "در درکهای دیکشنری، یک عبارت دو ستارهدار ارزیابی شده و سپس با استفاده از :ref:`بازکردن دیکشنری <dict-unpacking>` باز میشود و صفر یا چند جفت کلید/مقدار را در دیکشنری جدید درج میکند. مانند سایر انواع نمایشهای دیکشنری، اگر یک کلید چندین بار مشخص شود، مقدار مرتبط در دیکشنری حاصل آخرین مقدار مشخصشده خواهد بود."
msgid "For example::"
msgstr "برای مثال::"
msgid ""
">>> system_defaults = {'color': 'blue', 'count': 8}\n"
">>> user_defaults = {'color': 'yellow'}\n"
">>> overrides = {'count': 5}\n"
"\n"
">>> configuration_sets = [system_defaults, user_defaults, overrides]\n"
"\n"
">>> {**d for d in configuration_sets}\n"
"{'color': 'yellow', 'count': 5}"
msgstr ""
">>> system_defaults = {'color': 'blue', 'count': 8}\n"
">>> user_defaults = {'color': 'yellow'}\n"
">>> overrides = {'count': 5}\n"
"\n"
">>> configuration_sets = [system_defaults, user_defaults, overrides]\n"
"\n"
">>> {**d for d in configuration_sets}\n"
"{'color': 'yellow', 'count': 5}"
msgid "Unpacking in comprehensions using the ``*`` and ``**`` operators was introduced in :pep:`798`."
msgstr "بازکردن بسته در درکها با استفاده از عملگرهای ``*`` و ``**`` در :pep:`798` معرفی شد."
msgid "Asynchronous comprehensions"
msgstr "درکهای ناهمگام"
msgid "In an :keyword:`async def` function, an :keyword:`!async for` clause may be used to iterate over a :term:`asynchronous iterator`. A comprehension in an :keyword:`!async def` function may consist of either a :keyword:`!for` or :keyword:`!async for` clause following the leading expression, may contain additional :keyword:`!for` or :keyword:`!async for` clauses, and may also use :keyword:`await` expressions."
msgstr "در یک تابع :keyword:`async def`، میتوان از یک بند :keyword:`!async for` برای پیمایش روی یک :term:`پیمایشگر ناهمگام <asynchronous iterator>` استفاده کرد. یک درک در یک تابع :keyword:`!async def` ممکن است شامل یک بند :keyword:`!for` یا :keyword:`!async for` به دنبال عبارت پیشرو باشد، ممکن است حاوی بندهای :keyword:`!for` یا :keyword:`!async for` اضافی باشد، و همچنین ممکن است از عبارتهای :keyword:`await` استفاده کند."
msgid "If a comprehension contains :keyword:`!async for` clauses, or if it contains :keyword:`!await` expressions or other asynchronous comprehensions anywhere except the iterable expression in the leftmost :keyword:`!for` clause, it is called an :dfn:`asynchronous comprehension`. An asynchronous comprehension may suspend the execution of the coroutine function in which it appears."
msgstr "اگر یک درک حاوی بندهای :keyword:`!async for` باشد، یا اگر حاوی عبارتهای :keyword:`!await` یا سایر درکهای ناهمگام در هر جایی بهجز عبارت پیمایشپذیر در سمت چپترین بند :keyword:`!for` باشد، به آن :dfn:`درک ناهمگام` گفته میشود. یک درک ناهمگام ممکن است اجرای تابع همروالی را که در آن ظاهر میشود، به حالت تعلیق درآورد."
msgid "Asynchronous comprehensions were introduced in :pep:`530`."
msgstr "درکهای ناهمگام در :pep:`530` معرفی شدند."
msgid "Asynchronous comprehensions are now allowed inside comprehensions in asynchronous functions. Outer comprehensions implicitly become asynchronous."
msgstr "درکهای ناهمگام اکنون در داخل درکها در توابع ناهمگام مجاز هستند. درکهای بیرونی بهطور ضمنی ناهمگام میشوند."
msgid "Formal grammar for comprehensions"
msgstr "گرامر رسمی برای درکها"
msgid "The formal grammar for comprehensions is:"
msgstr "گرامر رسمی برای درکها عبارت است از:"
msgid "Generator expressions"
msgstr "عبارتهای تولیدگر"
msgid "The syntax for :dfn:`generator expressions` is the same as for list :ref:`comprehensions <comprehensions>`, except that they are enclosed in parentheses instead of brackets. For example::"
msgstr "سینتکس :dfn:`عبارتهای تولیدگر (generator expressions)` همانند :ref:`درکهای فهرستی <comprehensions>` است، با این تفاوت که آنها به جای کروشه در پرانتز قرار میگیرند. برای مثال::"
msgid ""
">>> iterator = (x ** 2 for x in range(10))\n"
">>> iterator\n"
"<generator object <genexpr> at ...>"
msgstr ""
">>> iterator = (x ** 2 for x in range(10))\n"
">>> iterator\n"
"<generator object <genexpr> at ...>"
msgid "At runtime, a generator expression evaluates to a :term:`generator iterator` which yields the same values as the corresponding list comprehension::"
msgstr "در رانتایم، یک عبارت تولیدگر به یک :term:`generator iterator` ارزیابی میشود که همان مقادیرِ درک فهرستی متناظر را تولید میکند::"
msgid ""
">>> list(iterator)\n"
"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]"
msgstr ""
">>> list(iterator)\n"
"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]"
msgid "Thus, the example above is roughly equivalent to defining and calling the following generator function::"
msgstr "بنابراین، مثال بالا تقریباً معادل تعریف و فراخوانی تابع تولیدگر زیر است::"
msgid ""
"def make_generator_of_squares(iterator):\n"
" for x in iterator:\n"
" yield x ** 2\n"
"\n"
"make_generator_of_squares(iter(range(10)))"
msgstr ""
"def make_generator_of_squares(iterator):\n"
" for x in iterator:\n"
" yield x ** 2\n"
"\n"
"make_generator_of_squares(iter(range(10)))"
msgid "The enclosing parentheses can be omitted in calls when the generator expression is the only positional argument and there are no keyword arguments. See the :ref:`Calls section <calls>` for details. For example::"
msgstr "هنگامی که عبارت تولیدگر تنها آرگومان جایگاهی باشد و هیچ آرگومان کلیدواژهای وجود نداشته باشد، میتوان پرانتزهای دربرگیرنده را در فراخوانیها حذف کرد. برای جزئیات، :ref:`بخش فراخوانیها <calls>` را ببینید. برای مثال::"
msgid ""
"# The parentheses after `sum` are part of the call syntax:\n"
">>> sum(x ** 2 for x in range(10))\n"
"285\n"
"\n"
"# The generator needs its own parentheses if it's not the only argument:\n"
">>> sum((x ** 2 for x in range(10)), start=1000)\n"
"1285"
msgstr ""
"# The parentheses after `sum` are part of the call syntax:\n"
">>> sum(x ** 2 for x in range(10))\n"
"285\n"
"\n"
"# The generator needs its own parentheses if it's not the only argument:\n"
">>> sum((x ** 2 for x in range(10)), start=1000)\n"
"1285"
msgid "The iterable expression in the leftmost :keyword:`!for` clause is evaluated immediately, so that an error raised by this expression will be emitted at the point where the generator expression is defined, rather than at the point where the first value is retrieved::"
msgstr "عبارت پیمایشپذیر در چپترین بند :keyword:`!for` بلافاصله ارزیابی میشود، بهطوری که خطایی که این عبارت پرتاب میکند، در نقطهای که عبارت تولیدگر تعریف میشود بروز میکند، نه در نقطهای که نخستین مقدار بازیابی میشود::"
msgid ""
">>> (x ** 2 for x in nonexistent_iterable)\n"
"Traceback (most recent call last):\n"
" ...\n"
"NameError: name 'nonexistent_iterable' is not defined"
msgstr ""
">>> (x ** 2 for x in nonexistent_iterable)\n"
"Traceback (most recent call last):\n"
" ...\n"
"NameError: name 'nonexistent_iterable' is not defined"
msgid "After the expression is evaluated, an iterator is created from the result, as if :py:func:`iter` was called on it. Any error raised when creating the iterator is also emitted immediately::"
msgstr "پس از ارزیابی عبارت، یک پیمایشگر از نتیجه ایجاد میشود، گویی که :py:func:`iter` بر روی آن فراخوانی شده است. هر خطایی که هنگام ایجاد پیمایشگر پرتاب شود نیز بلافاصله منتشر میشود::"
msgid ""
">>> (x ** 2 for x in None)\n"
"Traceback (most recent call last):\n"
" ...\n"
"TypeError: 'NoneType' object is not iterable"
msgstr ""
">>> (x ** 2 for x in None)\n"
"Traceback (most recent call last):\n"
" ...\n"
"TypeError: 'NoneType' object is not iterable"
msgid "All other expressions are evaluated lazily, in the same fashion as normal generators (that is, when the iterator is asked to yield a value)::"
msgstr "تمام عبارتهای دیگر بهصورت تنبل ارزیابی میشوند، به همان شیوهی تولیدگرهای معمولی (یعنی زمانی که از پیمایشگر خواسته شود مقداری را yield کند)::"
msgid ""
">>> iterator = (nonexistent_value for x in range(10))\n"
">>> iterator\n"
"<generator object <genexpr> at ...>\n"
">>> list(iterator)\n"
"Traceback (most recent call last):\n"
" ...\n"
"NameError: name 'nonexistent_value' is not defined"
msgstr ""
">>> iterator = (nonexistent_value for x in range(10))\n"
">>> iterator\n"
"<generator object <genexpr> at ...>\n"
">>> list(iterator)\n"