-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathprogramming.po
More file actions
4003 lines (3487 loc) · 166 KB
/
programming.po
File metadata and controls
4003 lines (3487 loc) · 166 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-2017, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-17 23:44+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Dong-gweon Oh <flowdas@gmail.com>\n"
"Language-Team: Korean (https://python.flowdas.com)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n"
#: ../../faq/programming.rst:5
msgid "Programming FAQ"
msgstr "프로그래밍 FAQ"
#: ../../faq/programming.rst:8
msgid "Contents"
msgstr "목차"
#: ../../faq/programming.rst:12
msgid "General Questions"
msgstr "일반적인 질문"
#: ../../faq/programming.rst:15
msgid ""
"Is there a source code level debugger with breakpoints, single-stepping, "
"etc.?"
msgstr "중단점, 단일 스테핑(single-stepping) 등을 포함하는 소스 코드 수준 디버거가 있습니까?"
#: ../../faq/programming.rst:17 ../../faq/programming.rst:58
msgid "Yes."
msgstr "예."
#: ../../faq/programming.rst:19
msgid ""
"Several debuggers for Python are described below, and the built-in "
"function :func:`breakpoint` allows you to drop into any of them."
msgstr ""
"파이썬을 위한 여러 디버거가 아래에 설명되어 있으며, 내장 함수 :func:`breakpoint`\\를 사용하면 이들 중 하나로 "
"들어갈 수 있습니다."
#: ../../faq/programming.rst:22
msgid ""
"The pdb module is a simple but adequate console-mode debugger for Python."
" It is part of the standard Python library, and is :mod:`documented in "
"the Library Reference Manual <pdb>`. You can also write your own debugger"
" by using the code for pdb as an example."
msgstr ""
"pdb 모듈은 간단하지만 적절한 파이썬 용 콘솔 모드 디버거입니다. 표준 파이썬 라이브러리의 일부이며, :mod:`라이브러리 "
"레퍼런스 매뉴얼에서 설명 <pdb>`\\하고 있습니다. pdb의 코드를 예로 사용하여 자체 디버거를 작성할 수도 있습니다."
#: ../../faq/programming.rst:27
#, fuzzy
msgid ""
"The IDLE interactive development environment, which is part of the "
"standard Python distribution (normally available as `Tools/scripts/idle3 "
"<https://github.com/python/cpython/blob/main/Tools/scripts/idle3>`_), "
"includes a graphical debugger."
msgstr ""
"표준 파이썬 배포의 일부인 (보통 Tools/scripts/idle에 있습니다) IDLE 대화식 개발 환경에는 그래픽 디버거가 "
"포함되어 있습니다."
#: ../../faq/programming.rst:32
#, fuzzy
msgid ""
"PythonWin is a Python IDE that includes a GUI debugger based on pdb. The"
" PythonWin debugger colors breakpoints and has quite a few cool features "
"such as debugging non-PythonWin programs. PythonWin is available as part"
" of `pywin32 <https://github.com/mhammond/pywin32>`_ project and as a "
"part of the `ActivePython "
"<https://www.activestate.com/products/python/>`_ distribution."
msgstr ""
"PythonWin은 pdb 기반 GUI 디버거를 포함하는 파이썬 IDE입니다. Pythonwin 디버거는 중단점에 색을 입히고 비 "
"Pythonwin 프로그램 디버깅과 같은 멋진 기능을 제공합니다. Pythonwin은 `Python for Windows "
"Extensions <https://sourceforge.net/projects/pywin32/>`__ 프로젝트의 일부와 "
"ActivePython 배포의 일부로 제공됩니다 (https://www.activestate.com/activepython 를 "
"참조하십시오)."
#: ../../faq/programming.rst:39
#, fuzzy
msgid ""
"`Eric <https://eric-ide.python-projects.org/>`_ is an IDE built on PyQt "
"and the Scintilla editing component."
msgstr ""
"`Eric <http://eric-ide.python-projects.org/>`_\\은 PyQt와 Scintilla 편집 "
"컴포넌트를 기반으로 하는 IDE입니다."
#: ../../faq/programming.rst:42
msgid ""
"`trepan3k <https://github.com/rocky/python3-trepan/>`_ is a gdb-like "
"debugger."
msgstr ""
#: ../../faq/programming.rst:44
msgid ""
"`Visual Studio Code <https://code.visualstudio.com/>`_ is an IDE with "
"debugging tools that integrates with version-control software."
msgstr ""
#: ../../faq/programming.rst:47
msgid ""
"There are a number of commercial Python IDEs that include graphical "
"debuggers. They include:"
msgstr "그래픽 디버거를 포함하는 많은 상용 파이썬 IDE가 있습니다. 다음을 포함합니다:"
#: ../../faq/programming.rst:50
#, fuzzy
msgid "`Wing IDE <https://wingware.com/>`_"
msgstr "Wing IDE (https://wingware.com/)"
#: ../../faq/programming.rst:51
msgid "`Komodo IDE <https://www.activestate.com/products/komodo-ide/>`_"
msgstr ""
#: ../../faq/programming.rst:52
#, fuzzy
msgid "`PyCharm <https://www.jetbrains.com/pycharm/>`_"
msgstr "PyCharm (https://www.jetbrains.com/pycharm/)"
#: ../../faq/programming.rst:56
msgid "Are there tools to help find bugs or perform static analysis?"
msgstr "버그를 찾거나 정적 분석을 수행하는 데 도움이 되는 도구가 있습니까?"
#: ../../faq/programming.rst:60
#, fuzzy
msgid ""
"`Pylint <https://pylint.pycqa.org/en/latest/index.html>`_ and `Pyflakes "
"<https://github.com/PyCQA/pyflakes>`_ do basic checking that will help "
"you catch bugs sooner."
msgstr ""
"`Pylint <https://www.pylint.org/>`_\\와 `Pyflakes "
"<https://github.com/PyCQA/pyflakes>`_\\는 버그를 더 빨리 발견하는 데 도움이 되는 기본 검사를 "
"수행합니다."
#: ../../faq/programming.rst:64
#, fuzzy
msgid ""
"Static type checkers such as `Mypy <https://mypy-lang.org/>`_, `Pyre "
"<https://pyre-check.org/>`_, and `Pytype "
"<https://github.com/google/pytype>`_ can check type hints in Python "
"source code."
msgstr ""
"`Mypy <http://mypy-lang.org/>`_, `Pyre <https://pyre-check.org/>`_ 및 "
"`Pytype <https://github.com/google/pytype>`_\\과 같은 정적 형 검사기는 파이썬 소스 코드에 "
"있는 형 힌트를 검사할 수 있습니다."
#: ../../faq/programming.rst:73
msgid "How can I create a stand-alone binary from a Python script?"
msgstr "파이썬 스크립트로 독립 실행형 바이너리를 만들려면 어떻게 해야 합니까?"
#: ../../faq/programming.rst:75
msgid ""
"You don't need the ability to compile Python to C code if all you want is"
" a stand-alone program that users can download and run without having to "
"install the Python distribution first. There are a number of tools that "
"determine the set of modules required by a program and bind these modules"
" together with a Python binary to produce a single executable."
msgstr ""
"사용자가 파이썬 배포를 먼저 설치하지 않고도 다운로드하여 실행할 수 있는 독립 실행형 프로그램을 원하는 것이 전부라면 파이썬을 C "
"코드로 컴파일하는 기능이 필요하지는 않습니다. 프로그램에 필요한 모듈 집합을 파악하고 이러한 모듈들을 파이썬 바이너리와 결합하여 "
"단일 실행 파일을 생성하는 많은 도구가 있습니다."
#: ../../faq/programming.rst:81
#, fuzzy
msgid ""
"One is to use the freeze tool, which is included in the Python source "
"tree as `Tools/freeze "
"<https://github.com/python/cpython/tree/main/Tools/freeze>`_. It converts"
" Python byte code to C arrays; with a C compiler you can embed all your "
"modules into a new program, which is then linked with the standard Python"
" modules."
msgstr ""
"그중 하나는 파이썬 소스 트리에 ``Tools/freeze``\\로 포함된 freeze 도구를 사용하는 것입니다. 파이썬 바이트 "
"코드를 C 배열로 변환합니다; C 컴파일러를 사용하면 모든 모듈을 새 프로그램에 내장시킨 다음 표준 파이썬 모듈과 링크할 수 "
"있습니다."
#: ../../faq/programming.rst:87
msgid ""
"It works by scanning your source recursively for import statements (in "
"both forms) and looking for the modules in the standard Python path as "
"well as in the source directory (for built-in modules). It then turns "
"the bytecode for modules written in Python into C code (array "
"initializers that can be turned into code objects using the marshal "
"module) and creates a custom-made config file that only contains those "
"built-in modules which are actually used in the program. It then "
"compiles the generated C code and links it with the rest of the Python "
"interpreter to form a self-contained binary which acts exactly like your "
"script."
msgstr ""
"소스를 재귀적으로 검색하여 import 문(두 형식 모두)을 찾고 표준 파이썬 경로뿐만 아니라 소스 디렉터리에서 모듈을 찾습니다 "
"(내장할 모듈을 위해). 그런 다음 파이썬으로 작성된 모듈의 바이트 코드를 C 코드 (marshal 모듈을 사용하여 코드 객체로 "
"변환할 수 있는 배열 초기화기)로 바꾸고 프로그램에서 실제로 사용되는 내장 모듈만 포함하는 특별한 구성 파일을 만듭니다. 그런 다음"
" 생성된 C 코드를 컴파일하고 이를 나머지 파이썬 인터프리터와 링크하여 스크립트와 똑같게 작동하는 자체 포함 바이너리를 형성합니다."
#: ../../faq/programming.rst:96
msgid ""
"The following packages can help with the creation of console and GUI "
"executables:"
msgstr ""
#: ../../faq/programming.rst:99
msgid "`Nuitka <https://nuitka.net/>`_ (Cross-platform)"
msgstr ""
#: ../../faq/programming.rst:100
msgid "`PyInstaller <https://pyinstaller.org/>`_ (Cross-platform)"
msgstr ""
#: ../../faq/programming.rst:101
msgid ""
"`PyOxidizer <https://pyoxidizer.readthedocs.io/en/stable/>`_ (Cross-"
"platform)"
msgstr ""
#: ../../faq/programming.rst:102
msgid ""
"`cx_Freeze <https://marcelotduarte.github.io/cx_Freeze/>`_ (Cross-"
"platform)"
msgstr ""
#: ../../faq/programming.rst:103
msgid "`py2app <https://github.com/ronaldoussoren/py2app>`_ (macOS only)"
msgstr ""
#: ../../faq/programming.rst:104
#, fuzzy
msgid "`py2exe <https://www.py2exe.org/>`_ (Windows only)"
msgstr "http://www.py2exe.org/"
#: ../../faq/programming.rst:107
msgid "Are there coding standards or a style guide for Python programs?"
msgstr "파이썬 프로그램을 위한 코딩 표준이나 스타일 지침서가 있습니까?"
#: ../../faq/programming.rst:109
msgid ""
"Yes. The coding style required for standard library modules is "
"documented as :pep:`8`."
msgstr "예. 표준 라이브러리 모듈에 요구되는 코딩 스타일은 :pep:`8`\\에서 설명합니다."
#: ../../faq/programming.rst:114
msgid "Core Language"
msgstr "핵심 언어"
#: ../../faq/programming.rst:119
msgid "Why am I getting an UnboundLocalError when the variable has a value?"
msgstr "변수에 값이 있을 때 UnboundLocalError 가 발생하는 이유는 무엇입니까?"
#: ../../faq/programming.rst:121
#, fuzzy
msgid ""
"It can be a surprise to get the :exc:`UnboundLocalError` in previously "
"working code when it is modified by adding an assignment statement "
"somewhere in the body of a function."
msgstr "전에는 동작하던 코드에서 함수 본문 어딘가에 대입문을 추가했을 때 UnboundLocalError 가 발생하면 당황할 수 있습니다."
#: ../../faq/programming.rst:125
msgid "This code:"
msgstr "이 코드는:"
#: ../../faq/programming.rst:134
msgid "works, but this code:"
msgstr "작동하지만, 이 코드는:"
#: ../../faq/programming.rst:141
#, fuzzy
msgid "results in an :exc:`!UnboundLocalError`:"
msgstr "UnboundLocalError 가 발생합니다:"
#: ../../faq/programming.rst:148
msgid ""
"This is because when you make an assignment to a variable in a scope, "
"that variable becomes local to that scope and shadows any similarly named"
" variable in the outer scope. Since the last statement in foo assigns a "
"new value to ``x``, the compiler recognizes it as a local variable. "
"Consequently when the earlier ``print(x)`` attempts to print the "
"uninitialized local variable and an error results."
msgstr ""
"이는 스코프에서 변수에 대입할 때, 해당 변수가 그 스코프에 대해 지역(local)이 되고 외부 스코프에서 비슷한 이름의 변수를 "
"가리기 때문입니다. foo의 마지막 문장은 ``x``\\에 새 값을 대입하므로, 컴파일러는 이 값을 지역 변수로 인식합니다. "
"결과적으로 앞의 ``print(x)``\\가 초기화되지 않은 지역 변수를 인쇄하려고 할 때 에러가 발생합니다."
#: ../../faq/programming.rst:155
msgid ""
"In the example above you can access the outer scope variable by declaring"
" it global:"
msgstr "위의 예에서 변수를 전역(global)으로 선언하여 외부 스코프 변수에 액세스 할 수 있습니다:"
#: ../../faq/programming.rst:167
msgid ""
"This explicit declaration is required in order to remind you that (unlike"
" the superficially analogous situation with class and instance variables)"
" you are actually modifying the value of the variable in the outer scope:"
msgstr ""
"이 명시적 선언은 (클래스와 인스턴스 변수의 표면적으로 유사한 상황과 달리) 실제로 외부 스코프에 있는 변수의 값을 수정하고 있음을"
" 상기시키기 위해 필요합니다:"
#: ../../faq/programming.rst:174
msgid ""
"You can do a similar thing in a nested scope using the "
":keyword:`nonlocal` keyword:"
msgstr ":keyword:`nonlocal` 키워드를 사용하여 중첩된 스코프에서 비슷한 일을 할 수 있습니다:"
#: ../../faq/programming.rst:192
msgid "What are the rules for local and global variables in Python?"
msgstr "파이썬에서 지역과 전역 변수에 대한 규칙은 무엇입니까?"
#: ../../faq/programming.rst:194
msgid ""
"In Python, variables that are only referenced inside a function are "
"implicitly global. If a variable is assigned a value anywhere within the"
" function's body, it's assumed to be a local unless explicitly declared "
"as global."
msgstr ""
"파이썬에서, 함수 내에서 참조되기만 하는 변수는 묵시적으로 전역입니다. 변수가 함수 본문 내 어디에서건 값을 대입하면, 명시적으로 "
"전역으로 선언되지 않는 한 지역으로 간주합니다."
#: ../../faq/programming.rst:198
msgid ""
"Though a bit surprising at first, a moment's consideration explains this."
" On one hand, requiring :keyword:`global` for assigned variables "
"provides a bar against unintended side-effects. On the other hand, if "
"``global`` was required for all global references, you'd be using "
"``global`` all the time. You'd have to declare as global every reference"
" to a built-in function or to a component of an imported module. This "
"clutter would defeat the usefulness of the ``global`` declaration for "
"identifying side-effects."
msgstr ""
"처음에는 조금 의외지만, 잠시 생각해보면 이해가 됩니다. 한편으로, 대입된 변수에 :keyword:`global`\\을 요구하면 "
"의도하지 않은 부작용에 대한 저지선을 제공합니다. 반면에, 모든 전역 참조에 ``global``\\이 요구된다면, 항상 "
"``global``\\을 사용하게 됩니다. 내장 함수나 임포트 한 모듈의 구성 요소에 대한 모든 참조를 전역으로 선언해야 합니다. "
"이 혼란은 부작용을 식별하기 위한 ``global`` 선언의 유용성을 무효로 합니다."
#: ../../faq/programming.rst:208
msgid ""
"Why do lambdas defined in a loop with different values all return the "
"same result?"
msgstr "다른 값으로 루프에서 정의된 람다는 왜 모두 같은 결과를 반환합니까?"
#: ../../faq/programming.rst:210
msgid ""
"Assume you use a for loop to define a few different lambdas (or even "
"plain functions), e.g.::"
msgstr "for 루프를 사용하여 몇 가지 다른 람다(또는 일반 함수조차)를 정의한다고 가정하십시오, 예를 들어::"
#: ../../faq/programming.rst:213
msgid ""
">>> squares = []\n"
">>> for x in range(5):\n"
"... squares.append(lambda: x**2)"
msgstr ""
#: ../../faq/programming.rst:217
msgid ""
"This gives you a list that contains 5 lambdas that calculate ``x**2``. "
"You might expect that, when called, they would return, respectively, "
"``0``, ``1``, ``4``, ``9``, and ``16``. However, when you actually try "
"you will see that they all return ``16``::"
msgstr ""
"이것은 ``x**2``\\를 계산하는 5개의 람다가 포함된 리스트를 제공합니다. 호출되면, 각각 ``0``, ``1``, "
"``4``, ``9`` 및 ``16``\\을 반환할 것으로 예상할 수 있습니다. 그러나, 실제로 시도하면 모두 ``16``\\을 "
"반환한다는 것을 알 수 있습니다::"
#: ../../faq/programming.rst:222
msgid ""
">>> squares[2]()\n"
"16\n"
">>> squares[4]()\n"
"16"
msgstr ""
#: ../../faq/programming.rst:227
msgid ""
"This happens because ``x`` is not local to the lambdas, but is defined in"
" the outer scope, and it is accessed when the lambda is called --- not "
"when it is defined. At the end of the loop, the value of ``x`` is ``4``,"
" so all the functions now return ``4**2``, i.e. ``16``. You can also "
"verify this by changing the value of ``x`` and see how the results of the"
" lambdas change::"
msgstr ""
"이는 ``x``\\가 람다에 지역(local)이 아니라 외부 스코프에 정의되어 있기 때문에 발생하며, 람다가 호출될 때 액세스 "
"됩니다 --- 정의될 때가 아닙니다. 루프의 끝에서, ``x``\\의 값은 ``4``\\이므로, 모든 함수는 이제 ``4**2``,"
" 즉 ``16``\\을 반환합니다. ``x``\\의 값을 변경하고 람다의 결과가 어떻게 변경되는지 봄으로써 이를 확인할 수도 "
"있습니다::"
#: ../../faq/programming.rst:233
msgid ""
">>> x = 8\n"
">>> squares[2]()\n"
"64"
msgstr ""
#: ../../faq/programming.rst:237
msgid ""
"In order to avoid this, you need to save the values in variables local to"
" the lambdas, so that they don't rely on the value of the global ``x``::"
msgstr "이를 피하려면, 람다에 대해 지역인 변수에 값을 저장하여, 전역 ``x``\\의 값에 의존하지 않도록 할 필요가 있습니다::"
#: ../../faq/programming.rst:240
msgid ""
">>> squares = []\n"
">>> for x in range(5):\n"
"... squares.append(lambda n=x: n**2)"
msgstr ""
#: ../../faq/programming.rst:244
msgid ""
"Here, ``n=x`` creates a new variable ``n`` local to the lambda and "
"computed when the lambda is defined so that it has the same value that "
"``x`` had at that point in the loop. This means that the value of ``n`` "
"will be ``0`` in the first lambda, ``1`` in the second, ``2`` in the "
"third, and so on. Therefore each lambda will now return the correct "
"result::"
msgstr ""
"여기서 ``n=x``\\는 람다에 지역인 새 변수 ``n``\\을 만들고, 루프의 해당 시점에서 ``x`` 와 같은 값을 갖도록 "
"람다가 정의될 때 계산됩니다. 이는 ``n``\\의 값이 첫 번째 람다에서 ``0``, 두 번째에서 ``1``, 세 번째에서 "
"``2`` 등이 됨을 의미합니다. 따라서 각 람다는 이제 올바른 결과를 반환합니다::"
#: ../../faq/programming.rst:250
msgid ""
">>> squares[2]()\n"
"4\n"
">>> squares[4]()\n"
"16"
msgstr ""
#: ../../faq/programming.rst:255
msgid ""
"Note that this behaviour is not peculiar to lambdas, but applies to "
"regular functions too."
msgstr "이 동작은 람다에만 국한된 것이 아니라 일반 함수에도 적용됩니다."
#: ../../faq/programming.rst:260
msgid "How do I share global variables across modules?"
msgstr "모듈 간에 전역 변수를 공유하려면 어떻게 해야 합니까?"
#: ../../faq/programming.rst:262
msgid ""
"The canonical way to share information across modules within a single "
"program is to create a special module (often called config or cfg). Just"
" import the config module in all modules of your application; the module "
"then becomes available as a global name. Because there is only one "
"instance of each module, any changes made to the module object get "
"reflected everywhere. For example:"
msgstr ""
"단일 프로그램 내에서 모듈 간에 정보를 공유하는 규범적인 방법은 특별한 모듈(종종 config나 cfg라고 불립니다)을 만드는 "
"것입니다. 응용 프로그램의 모든 모듈에서 config 모듈을 임포트 하기만 하면 됩니다; 그러면 모듈이 전역 이름으로 사용 "
"가능해집니다. 각 모듈의 인스턴스는 오직 하나이기 때문에, 모듈 객체에 대한 변경 사항은 모든 곳에 반영됩니다. 예를 들면 다음과 "
"같습니다:"
#: ../../faq/programming.rst:268
msgid "config.py::"
msgstr "config.py::"
#: ../../faq/programming.rst:270
msgid "x = 0 # Default value of the 'x' configuration setting"
msgstr ""
#: ../../faq/programming.rst:272
msgid "mod.py::"
msgstr "mod.py::"
#: ../../faq/programming.rst:274
msgid ""
"import config\n"
"config.x = 1"
msgstr ""
#: ../../faq/programming.rst:277
msgid "main.py::"
msgstr "main.py::"
#: ../../faq/programming.rst:279
msgid ""
"import config\n"
"import mod\n"
"print(config.x)"
msgstr ""
#: ../../faq/programming.rst:283
#, fuzzy
msgid ""
"Note that using a module is also the basis for implementing the singleton"
" design pattern, for the same reason."
msgstr "같은 이유로, 모듈을 사용하는 것도 싱글톤 디자인 패턴 구현을 위한 기초입니다."
#: ../../faq/programming.rst:288
msgid "What are the \"best practices\" for using import in a module?"
msgstr "모듈에서 임포트를 사용하는 \"모범 사례\"는 무엇입니까?"
#: ../../faq/programming.rst:290
msgid ""
"In general, don't use ``from modulename import *``. Doing so clutters "
"the importer's namespace, and makes it much harder for linters to detect "
"undefined names."
msgstr ""
"일반적으로, ``from modulename import *``\\를 사용하지 마십시오. 그렇게 하면 임포트 하는 곳의 이름 공간이"
" 어수선해지고, 린터(linter)가 정의되지 않은 이름을 감지하기가 훨씬 어려워집니다."
#: ../../faq/programming.rst:294
msgid ""
"Import modules at the top of a file. Doing so makes it clear what other "
"modules your code requires and avoids questions of whether the module "
"name is in scope. Using one import per line makes it easy to add and "
"delete module imports, but using multiple imports per line uses less "
"screen space."
msgstr ""
"파일 맨 위에서 모듈을 임포트 하십시오. 그렇게 하면 코드에 필요한 다른 모듈을 명확하게 하고 모듈 이름이 스코프에 있는지에 대한 "
"질문을 피할 수 있습니다. 한 줄에 하나의 임포트를 사용하면 모듈 임포트를 쉽게 추가하고 삭제할 수 있지만, 한 줄에 여러 임포트를"
" 사용하면 화면 공간을 덜 사용합니다."
#: ../../faq/programming.rst:299
msgid "It's good practice if you import modules in the following order:"
msgstr "다음 순서로 모듈을 임포트 하는 것이 좋습니다:"
#: ../../faq/programming.rst:301
#, fuzzy
msgid ""
"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, "
":mod:`re`"
msgstr "표준 라이브러리 모듈 -- 예를 들어 ``sys``, ``os``, ``getopt``, ``re``"
#: ../../faq/programming.rst:302
#, fuzzy
msgid ""
"third-party library modules (anything installed in Python's site-packages"
" directory) -- e.g. :mod:`!dateutil`, :mod:`!requests`, :mod:`!PIL.Image`"
msgstr ""
"제삼자 라이브러리 모듈 (파이썬의 site-packages 디렉터리에 설치된 모든 것) -- 예를 들어 mx.DateTime, "
"ZODB, PIL.Image 등."
#: ../../faq/programming.rst:304
#, fuzzy
msgid "locally developed modules"
msgstr "내부에서 개발된 모듈"
#: ../../faq/programming.rst:306
msgid ""
"It is sometimes necessary to move imports to a function or class to avoid"
" problems with circular imports. Gordon McMillan says:"
msgstr ""
"순환 임포트 관련 문제를 피하고자 임포트를 함수나 클래스로 이동해야 하는 경우가 있습니다. Gordon McMillan은 다음과 "
"같이 말했습니다:"
#: ../../faq/programming.rst:309
msgid ""
"Circular imports are fine where both modules use the \"import <module>\" "
"form of import. They fail when the 2nd module wants to grab a name out "
"of the first (\"from module import name\") and the import is at the top "
"level. That's because names in the 1st are not yet available, because "
"the first module is busy importing the 2nd."
msgstr ""
"두 모듈 모두 \"import <module>\" 형식의 임포트를 사용하면 순환 임포트는 괜찮습니다. 두 번째 모듈이 첫 번째 "
"모듈의 이름(name)을 붙잡으려고 하고 (\"from module import name\") 임포트가 최상위 수준에 있으면 "
"실패합니다. 첫 번째 모듈이 두 번째 모듈을 임포트 하는 중이라서 첫 번째 모듈에 있는 이름을 아직 사용할 수 없기 때문입니다."
#: ../../faq/programming.rst:315
msgid ""
"In this case, if the second module is only used in one function, then the"
" import can easily be moved into that function. By the time the import "
"is called, the first module will have finished initializing, and the "
"second module can do its import."
msgstr ""
"이 경우, 두 번째 모듈이 하나의 함수에서만 사용된다면, 임포트를 해당 함수로 쉽게 이동할 수 있습니다. 임포트가 호출될 때, 첫 "
"번째 모듈의 초기화가 완료되었고, 두 번째 모듈은 임포트를 수행할 수 있습니다."
#: ../../faq/programming.rst:320
msgid ""
"It may also be necessary to move imports out of the top level of code if "
"some of the modules are platform-specific. In that case, it may not even"
" be possible to import all of the modules at the top of the file. In "
"this case, importing the correct modules in the corresponding platform-"
"specific code is a good option."
msgstr ""
"일부 모듈이 플랫폼 특정이면 임포트를 코드의 최상위 수준에서 다른 곳으로 이동해야 할 수도 있습니다. 이 경우, 파일 맨 위에서 "
"모든 모듈을 임포트 하는 것이 가능하지 않을 수도 있습니다. 이 경우, 해당 플랫폼 특정 코드에서 올바른 모듈을 임포트 하는 것이 "
"좋은 선택입니다."
#: ../../faq/programming.rst:325
msgid ""
"Only move imports into a local scope, such as inside a function "
"definition, if it's necessary to solve a problem such as avoiding a "
"circular import or are trying to reduce the initialization time of a "
"module. This technique is especially helpful if many of the imports are "
"unnecessary depending on how the program executes. You may also want to "
"move imports into a function if the modules are only ever used in that "
"function. Note that loading a module the first time may be expensive "
"because of the one time initialization of the module, but loading a "
"module multiple times is virtually free, costing only a couple of "
"dictionary lookups. Even if the module name has gone out of scope, the "
"module is probably available in :data:`sys.modules`."
msgstr ""
"순환 임포트를 피하거나 모듈의 초기화 시간을 줄이려는 등의 문제를 해결하는 데 필요할 때만, 함수 정의 내부와 같은 지역 스코프로 "
"임포트를 옮기십시오. 이 기법은 프로그램 실행 방법에 따라 많은 임포트가 필요하지 않을 때 특히 유용합니다. 모듈이 해당 함수에서만"
" 사용될 때 임포트를 함수로 옮기고 싶을 수도 있습니다. 모듈의 일회성 초기화 때문에 모듈을 처음 로드하는 데 비용이 많이들 수 "
"있지만, 모듈을 여러 번 로드하는 것은 사실상 무료임에 유의하십시오, 두 번의 딕셔너리 조회만 발생합니다. 모듈 이름이 스코프를 "
"벗어난 경우에도, 모듈은 아마도 :data:`sys.modules`\\에 있을 겁니다."
#: ../../faq/programming.rst:338
msgid "Why are default values shared between objects?"
msgstr "객체 간에 기본값이 공유되는 이유는 무엇입니까?"
#: ../../faq/programming.rst:340
msgid ""
"This type of bug commonly bites neophyte programmers. Consider this "
"function::"
msgstr "이 유형의 버그는 흔히 신참 프로그래머들을 깨뭅니다. 이 함수를 생각해보십시오::"
#: ../../faq/programming.rst:342
#, python-brace-format
msgid ""
"def foo(mydict={}): # Danger: shared reference to one dict for all calls"
"\n"
" ... compute something ...\n"
" mydict[key] = value\n"
" return mydict"
msgstr ""
#: ../../faq/programming.rst:347
msgid ""
"The first time you call this function, ``mydict`` contains a single item."
" The second time, ``mydict`` contains two items because when ``foo()`` "
"begins executing, ``mydict`` starts out with an item already in it."
msgstr ""
"이 함수를 처음 호출하면, ``mydict``\\에 단일 항목이 포함됩니다. 두 번째는, ``foo()``\\가 실행되기 시작할 "
"때, ``mydict``\\가 이미 항목에 들어 있는 상태로 시작하기 때문에, ``mydict``\\가 두 개의 항목을 포함합니다."
#: ../../faq/programming.rst:351
msgid ""
"It is often expected that a function call creates new objects for default"
" values. This is not what happens. Default values are created exactly "
"once, when the function is defined. If that object is changed, like the "
"dictionary in this example, subsequent calls to the function will refer "
"to this changed object."
msgstr ""
"종종 함수 호출이 기본값으로 새 객체를 만들 것으로 기대합니다. 그렇게 되지 않습니다. 함수가 정의될 때, 기본값은 정확히 한 번 "
"만들어집니다. 이 예제의 딕셔너리와 같이, 해당 객체가 변경되면, 함수에 대한 후속 호출은 이 변경된 객체를 참조합니다."
#: ../../faq/programming.rst:356
msgid ""
"By definition, immutable objects such as numbers, strings, tuples, and "
"``None``, are safe from change. Changes to mutable objects such as "
"dictionaries, lists, and class instances can lead to confusion."
msgstr ""
"정의에 따라, 숫자, 문자열, 튜플 및 ``None``\\과 같은 불변 객체는 변경에 안전합니다. 딕셔너리, 리스트 및 클래스 "
"인스턴스와 같은 가변 객체를 변경하면 혼란스러울 수 있습니다."
#: ../../faq/programming.rst:360
msgid ""
"Because of this feature, it is good programming practice to not use "
"mutable objects as default values. Instead, use ``None`` as the default "
"value and inside the function, check if the parameter is ``None`` and "
"create a new list/dictionary/whatever if it is. For example, don't "
"write::"
msgstr ""
"이 기능으로 인해, 가변 객체를 기본값으로 사용하지 않는 것이 좋습니다. 대신, ``None``\\을 기본값으로 사용하고 함수 "
"내부에서 매개변수가 ``None``\\인지 확인한 다음 새 리스트/딕셔너리/무엇이든 새로 만드십시오. 예를 들어, 다음과 같이 쓰지"
" 마십시오::"
#: ../../faq/programming.rst:365
#, python-brace-format
msgid ""
"def foo(mydict={}):\n"
" ..."
msgstr ""
#: ../../faq/programming.rst:368
msgid "but::"
msgstr "대신 이렇게 쓰십시오::"
#: ../../faq/programming.rst:370
#, python-brace-format
msgid ""
"def foo(mydict=None):\n"
" if mydict is None:\n"
" mydict = {} # create a new dict for local namespace"
msgstr ""
#: ../../faq/programming.rst:374
msgid ""
"This feature can be useful. When you have a function that's time-"
"consuming to compute, a common technique is to cache the parameters and "
"the resulting value of each call to the function, and return the cached "
"value if the same value is requested again. This is called "
"\"memoizing\", and can be implemented like this::"
msgstr ""
"이 기능은 유용할 수 있습니다. 계산하는 데 시간이 걸리는 함수가 있을 때, 일반적인 기법은 각 함수 호출의 매개변수와 결괏값을 "
"캐시하고, 같은 값이 다시 요청되면 캐시 된 값을 반환하는 것입니다. 이것을 \"memoizing\" 이라고 하며, 다음과 같이 "
"구현할 수 있습니다::"
#: ../../faq/programming.rst:379
#, python-brace-format
msgid ""
"# Callers can only provide two parameters and optionally pass _cache by "
"keyword\n"
"def expensive(arg1, arg2, *, _cache={}):\n"
" if (arg1, arg2) in _cache:\n"
" return _cache[(arg1, arg2)]\n"
"\n"
" # Calculate the value\n"
" result = ... expensive computation ...\n"
" _cache[(arg1, arg2)] = result # Store result in the cache\n"
" return result"
msgstr ""
#: ../../faq/programming.rst:389
msgid ""
"You could use a global variable containing a dictionary instead of the "
"default value; it's a matter of taste."
msgstr "기본값 대신 딕셔너리를 포함하는 전역 변수를 사용할 수 있습니다; 취향의 문제입니다."
#: ../../faq/programming.rst:394
msgid ""
"How can I pass optional or keyword parameters from one function to "
"another?"
msgstr "한 함수에서 다른 함수로 선택적이나 키워드 매개변수를 전달하려면 어떻게 해야 합니까?"
#: ../../faq/programming.rst:396
msgid ""
"Collect the arguments using the ``*`` and ``**`` specifiers in the "
"function's parameter list; this gives you the positional arguments as a "
"tuple and the keyword arguments as a dictionary. You can then pass these"
" arguments when calling another function by using ``*`` and ``**``::"
msgstr ""
"함수의 매개변수 목록에 ``*``\\와 ``**`` 지정자를 사용하여 인자를 수집하십시오; 이것은 위치 인자를 튜플로, 키워드 "
"인자를 딕셔너리로 제공합니다. 그런 다음 ``*``\\와 ``**``\\를 사용하여 다른 함수를 호출할 때 이러한 인자를 전달할 수"
" 있습니다::"
#: ../../faq/programming.rst:401
msgid ""
"def f(x, *args, **kwargs):\n"
" ...\n"
" kwargs['width'] = '14.3c'\n"
" ...\n"
" g(x, *args, **kwargs)"
msgstr ""
#: ../../faq/programming.rst:415
msgid "What is the difference between arguments and parameters?"
msgstr "인자와 매개변수의 차이점은 무엇입니까?"
#: ../../faq/programming.rst:417
#, fuzzy
msgid ""
":term:`Parameters <parameter>` are defined by the names that appear in a "
"function definition, whereas :term:`arguments <argument>` are the values "
"actually passed to a function when calling it. Parameters define what "
":term:`kind of arguments <parameter>` a function can accept. For "
"example, given the function definition::"
msgstr ""
":term:`매개변수 <parameter>`\\는 함수 정의에 나타나는 이름으로 정의되는 반면, :term:`인자 "
"<argument>`\\는 함수를 호출할 때 실제로 함수에 전달되는 값입니다. 매개변수는 함수가 받아들일 수 있는 인자 형을 "
"정의합니다. 예를 들어, 다음과 같은 함수 정의가 주어졌을 때::"
#: ../../faq/programming.rst:423
msgid ""
"def func(foo, bar=None, **kwargs):\n"
" pass"
msgstr ""
#: ../../faq/programming.rst:426
msgid ""
"*foo*, *bar* and *kwargs* are parameters of ``func``. However, when "
"calling ``func``, for example::"
msgstr ""
"*foo*, *bar* 및 *kwargs*\\는 ``func``\\의 매개변수입니다. 그러나, ``func``\\를 호출할 때, "
"예를 들면::"
#: ../../faq/programming.rst:429
msgid "func(42, bar=314, extra=somevar)"
msgstr ""
#: ../../faq/programming.rst:431
msgid "the values ``42``, ``314``, and ``somevar`` are arguments."
msgstr "``42``, ``314`` 및 ``somevar`` 값은 인자입니다."
#: ../../faq/programming.rst:435
msgid "Why did changing list 'y' also change list 'x'?"
msgstr "리스트 'y'를 변경할 때 리스트 'x'도 변경되는 이유는 무엇입니까?"
#: ../../faq/programming.rst:437
msgid "If you wrote code like::"
msgstr "다음과 같은 코드를 작성하면::"
#: ../../faq/programming.rst:439
msgid ""
">>> x = []\n"
">>> y = x\n"
">>> y.append(10)\n"
">>> y\n"
"[10]\n"
">>> x\n"
"[10]"
msgstr ""
#: ../../faq/programming.rst:447
msgid ""
"you might be wondering why appending an element to ``y`` changed ``x`` "
"too."
msgstr "``y``\\에 요소를 추가하면 ``x``\\도 변경되는 이유가 궁금할 것입니다."
#: ../../faq/programming.rst:449
msgid "There are two factors that produce this result:"
msgstr "이 결과를 만드는 두 가지 요소가 있습니다:"
#: ../../faq/programming.rst:451
msgid ""
"Variables are simply names that refer to objects. Doing ``y = x`` "
"doesn't create a copy of the list -- it creates a new variable ``y`` that"
" refers to the same object ``x`` refers to. This means that there is "
"only one object (the list), and both ``x`` and ``y`` refer to it."
msgstr ""
"변수는 단순히 객체를 가리키는 이름입니다. ``y = x``\\를 수행하면 리스트의 사본을 만들지 않습니다 -- ``x``\\가 "
"참조하는 것과 같은 객체를 참조하는 새 변수 ``y``\\를 만듭니다. 이는 하나의 객체(리스트)만 있고, ``x`` 와 ``y``"
" 모두 그 객체를 참조함을 의미합니다."
#: ../../faq/programming.rst:455
msgid "Lists are :term:`mutable`, which means that you can change their content."
msgstr "리스트는 :term:`가변 <mutable>`\\입니다, 내용을 변경할 수 있다는 뜻입니다."
#: ../../faq/programming.rst:457
#, fuzzy
msgid ""
"After the call to :meth:`!append`, the content of the mutable object has "
"changed from ``[]`` to ``[10]``. Since both the variables refer to the "
"same object, using either name accesses the modified value ``[10]``."
msgstr ""
":meth:`~list.append`\\를 호출한 후, 가변 객체의 내용이 ``[]``\\에서 ``[10]`` 으로 변경되었습니다."
" 두 변수가 모두 동일한 객체를 참조하기 때문에, 두 이름 중 어느 것을 사용하더라도 수정된 값 ``[10]`` 에 액세스합니다."
#: ../../faq/programming.rst:461
msgid "If we instead assign an immutable object to ``x``::"
msgstr "대신 불변 객체를 ``x``\\에 대입하면::"
#: ../../faq/programming.rst:463
msgid ""
">>> x = 5 # ints are immutable\n"
">>> y = x\n"
">>> x = x + 1 # 5 can't be mutated, we are creating a new object here\n"
">>> x\n"
"6\n"
">>> y\n"
"5"
msgstr ""
#: ../../faq/programming.rst:471
msgid ""
"we can see that in this case ``x`` and ``y`` are not equal anymore. This"
" is because integers are :term:`immutable`, and when we do ``x = x + 1`` "
"we are not mutating the int ``5`` by incrementing its value; instead, we "
"are creating a new object (the int ``6``) and assigning it to ``x`` (that"
" is, changing which object ``x`` refers to). After this assignment we "
"have two objects (the ints ``6`` and ``5``) and two variables that refer "
"to them (``x`` now refers to ``6`` but ``y`` still refers to ``5``)."
msgstr ""
"이 경우 ``x`` 와 ``y``\\가 더는 같지 않다는 것을 알 수 있습니다. 이는 정수가 :term:`불변 "
"<immutable>`\\이기 때문이고, ``x = x + 1``\\을 수행할 때 값을 증가시켜서 정수 ``5``\\를 변경하는 "
"것이 아닙니다; 대신 새 객체(정수 ``6``)를 만들어 ``x``\\에 대입합니다 (즉, ``x``\\가 참조하는 객체를 "
"바꿉니다). 이 대입 후에는 두 개의 객체(정수 ``6``\\과 ``5``)와 이를 참조하는 두 개의 변수를 갖게 됩니다 "
"(``x``\\는 이제 ``6``\\을 참조하지만, ``y``\\는 여전히 ``5``\\를 참조합니다)."
#: ../../faq/programming.rst:479
#, fuzzy
msgid ""
"Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate "
"the object, whereas superficially similar operations (for example ``y = y"
" + [10]`` and :func:`sorted(y) <sorted>`) create a new object. In "
"general in Python (and in all cases in the standard library) a method "
"that mutates an object will return ``None`` to help avoid getting the two"
" types of operations confused. So if you mistakenly write ``y.sort()`` "
"thinking it will give you a sorted copy of ``y``, you'll instead end up "
"with ``None``, which will likely cause your program to generate an easily"
" diagnosed error."
msgstr ""
"일부 연산(예를 들어 ``y.append(10)``\\과 ``y.sort()``)은 객체를 변경하지만, 표면적으로 유사한 연산(예를"
" 들어 ``y = y + [10]`` 과 ``sorted(y)``)은 새 객체를 만듭니다. 일반적으로 파이썬에서 (그리고 표준 "
"라이브러리의 모든 경우에서) 객체를 변경하는 메서드는 ``None``\\을 반환하여 두 가지 유형의 연산이 혼동되지 않도록 합니다."
" 따라서 실수로 ``y.sort()``\\라고 작성하고 ``y``\\의 정렬된 사본을 얻을 수 있다고 생각하면, 대신 "
"``None``\\을 얻어서 프로그램에서 쉽게 진단되는 에러가 발생하도록 합니다."
#: ../../faq/programming.rst:488
msgid ""
"However, there is one class of operations where the same operation "
"sometimes has different behaviors with different types: the augmented "
"assignment operators. For example, ``+=`` mutates lists but not tuples "
"or ints (``a_list += [1, 2, 3]`` is equivalent to ``a_list.extend([1, 2, "
"3])`` and mutates ``a_list``, whereas ``some_tuple += (1, 2, 3)`` and "
"``some_int += 1`` create new objects)."
msgstr ""
"그러나, 같은 연산이 때때로 형에 따라 다른 동작을 갖는 한 가지 연산 클래스가 있습니다: 증분 대입 연산자. 예를 들어, "
"``+=``\\는 리스트를 변경하지만, 튜플이나 정수는 변경하지 않습니다 (``a_list += [1, 2, 3]``\\은 "
"``a_list.extend([1, 2, 3])``\\과 동등하고 ``a_list``\\를 변경하지만, ``some_tuple "
"+= (1, 2, 3)``\\과 ``some_int += 1``\\은 새 객체를 만듭니다)."
#: ../../faq/programming.rst:495
msgid "In other words:"
msgstr "달리 표현하면:"
#: ../../faq/programming.rst:497
msgid ""
"If we have a mutable object (:class:`list`, :class:`dict`, :class:`set`, "
"etc.), we can use some specific operations to mutate it and all the "
"variables that refer to it will see the change."
msgstr ""
"가변 객체(:class:`list`, :class:`dict`, :class:`set` 등)가 있으면, 일부 특정 연산을 사용하여 "
"객체를 변경하면 해당 객체를 참조하는 모든 변수가 변경을 보게 됩니다."
#: ../../faq/programming.rst:500
msgid ""
"If we have an immutable object (:class:`str`, :class:`int`, "
":class:`tuple`, etc.), all the variables that refer to it will always see"
" the same value, but operations that transform that value into a new "
"value always return a new object."
msgstr ""
"불변 객체(:class:`str`, :class:`int`, :class:`tuple` 등)가 있으면, 이를 참조하는 모든 변수는 "
"항상 같은 값을 보게 되지만, 해당 값을 새로운 값으로 변환하는 연산은 항상 새로운 객체를 반환합니다."
#: ../../faq/programming.rst:505
msgid ""
"If you want to know if two variables refer to the same object or not, you"
" can use the :keyword:`is` operator, or the built-in function :func:`id`."
msgstr ""
"두 변수가 같은 객체를 참조하는지를 알고 싶다면, :keyword:`is` 연산자나 내장 함수 :func:`id`\\를 사용할 수 "
"있습니다."
#: ../../faq/programming.rst:510
msgid "How do I write a function with output parameters (call by reference)?"
msgstr "출력 매개변수가 있는 함수를 작성하려면 어떻게 해야 합니까 (참조에 의한 호출)?"
#: ../../faq/programming.rst:512
msgid ""
"Remember that arguments are passed by assignment in Python. Since "
"assignment just creates references to objects, there's no alias between "
"an argument name in the caller and callee, and so no call-by-reference "
"per se. You can achieve the desired effect in a number of ways."
msgstr ""
"파이썬에서 인자는 대입으로 전달됨을 기억하십시오. 대입은 단지 객체에 대한 참조를 만들기 때문에, 호출자와 피호출자의 인자 이름 "
"간에 에일리어스가 없고, 참조에 의한 호출도 없습니다. 여러 가지 방법으로 원하는 효과를 얻을 수 있습니다."
#: ../../faq/programming.rst:517
msgid "By returning a tuple of the results::"
msgstr "결과의 튜플을 반환하여::"
#: ../../faq/programming.rst:519
msgid ""
">>> def func1(a, b):\n"
"... a = 'new-value' # a and b are local names\n"
"... b = b + 1 # assigned to new objects\n"
"... return a, b # return new values\n"
"...\n"
">>> x, y = 'old-value', 99\n"
">>> func1(x, y)\n"
"('new-value', 100)"
msgstr ""
#: ../../faq/programming.rst:528
msgid "This is almost always the clearest solution."
msgstr "이것은 거의 항상 가장 명확한 해법입니다."
#: ../../faq/programming.rst:530
msgid ""
"By using global variables. This isn't thread-safe, and is not "
"recommended."
msgstr "전역 변수를 사용하여. 이것은 스레드 안전하지 않고, 권장하지 않습니다."
#: ../../faq/programming.rst:532
msgid "By passing a mutable (changeable in-place) object::"
msgstr "가변 (제자리에서 변경할 수 있는) 객체를 전달하여::"
#: ../../faq/programming.rst:534
msgid ""
">>> def func2(a):\n"
"... a[0] = 'new-value' # 'a' references a mutable list\n"
"... a[1] = a[1] + 1 # changes a shared object\n"
"...\n"
">>> args = ['old-value', 99]\n"
">>> func2(args)\n"
">>> args\n"
"['new-value', 100]"
msgstr ""
#: ../../faq/programming.rst:543
msgid "By passing in a dictionary that gets mutated::"
msgstr "변경되는 딕셔너리를 전달하여::"
#: ../../faq/programming.rst:545
#, python-brace-format
msgid ""
">>> def func3(args):\n"
"... args['a'] = 'new-value' # args is a mutable dictionary\n"
"... args['b'] = args['b'] + 1 # change it in-place\n"
"...\n"
">>> args = {'a': 'old-value', 'b': 99}\n"
">>> func3(args)\n"