Repository navigation
Expand file tree
/
Copy pathclasses.po
More file actions
2028 lines (1874 loc) · 121 KB
/
Copy pathclasses.po
File metadata and controls
2028 lines (1874 loc) · 121 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
# Punjabi translations for Python package.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# <EMAIL@ADDRESS>, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.16\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-06-11 15:24+0530\n"
"PO-Revision-Date: 2026-06-14 22:47+0530\n"
"Last-Translator: Bhuvansh Kataria <bhuvanshkataria@gmail.com>\n"
"Language-Team: Punjabi (India)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pa\n"
#: ../../tutorial/classes.rst:5
msgid "Classes"
msgstr "ਕਲਾਸਾਂ"
#: ../../tutorial/classes.rst:7
msgid ""
"Classes provide a means of bundling data and functionality together. "
"Creating a new class creates a new *type* of object, allowing new "
"*instances* of that type to be made. Each class instance can have "
"attributes attached to it for maintaining its state. Class instances can "
"also have methods (defined by its class) for modifying its state."
msgstr ""
"ਕਲਾਸਾਂ ਡਾਟਾ ਅਤੇ ਕਾਰਜਕੁਸ਼ਲਤਾ ਨੂੰ ਇਕੱਠੇ ਸੰਗਠਿਤ ਕਰਨ ਦਾ ਇੱਕ ਤਰੀਕਾ ਪ੍ਰਦਾਨ "
"ਕਰਦੀਆਂ ਹਨ। ਇੱਕ ਨਵੀਂ ਕਲਾਸ ਬਣਾਉਣ ਨਾਲ ਵਸਤੂ ਦੀ ਇੱਕ ਨਵੀਂ *ਕਿਸਮ* ਬਣਦੀ ਹੈ, ਜਿਸ "
"ਨਾਲ ਉਸ ਕਿਸਮ ਦੇ ਨਵੇਂ *ਇੰਸਟੈਂਸ* ਬਣਾਏ ਜਾ ਸਕਦੇ ਹਨ। ਹਰ ਕਲਾਸ ਇੰਸਟੈਂਸ ਨਾਲ ਉਸਦੀ "
"ਸਥਿਤੀ ਬਣਾਈ ਰੱਖਣ ਲਈ ਗੁਣ (attributes) ਜੋੜੇ ਜਾ ਸਕਦੇ ਹਨ। ਕਲਾਸ ਇੰਸਟੈਂਸਾਂ ਵਿੱਚ "
"ਉਨ੍ਹਾਂ ਦੀ ਸਥਿਤੀ ਨੂੰ ਬਦਲਣ ਲਈ ਵਿਧੀਆਂ (methods) ਵੀ ਹੋ ਸਕਦੀਆਂ ਹਨ, ਜੋ ਕਲਾਸ "
"ਵੱਲੋਂ ਪਰਿਭਾਸ਼ਿਤ ਕੀਤੀਆਂ ਜਾਂਦੀਆਂ ਹਨ।"
#: ../../tutorial/classes.rst:13
msgid ""
"Compared with other programming languages, Python's class mechanism adds "
"classes with a minimum of new syntax and semantics. It is a mixture of the "
"class mechanisms found in C++ and Modula-3. Python classes provide all the "
"standard features of Object Oriented Programming: the class inheritance "
"mechanism allows multiple base classes, a derived class can override any "
"methods of its base class or classes, and a method can call the method of a "
"base class with the same name. Objects can contain arbitrary amounts and "
"kinds of data. As is true for modules, classes partake of the dynamic "
"nature of Python: they are created at runtime, and can be modified further "
"after creation."
msgstr ""
"ਹੋਰ ਪ੍ਰੋਗਰਾਮਿੰਗ ਭਾਸ਼ਾਵਾਂ ਨਾਲ ਤੁਲਨਾ ਕਰਨ ਤੇ, Python ਦੀ ਕਲਾਸ ਪ੍ਰਣਾਲੀ ਘੱਟ ਤੋਂ "
"ਘੱਟ ਨਵੇਂ ਸਿੰਟੈਕਸ ਅਤੇ ਅਰਥਾਤਮਕ ਨਿਯਮਾਂ ਨਾਲ ਕਲਾਸਾਂ ਪ੍ਰਦਾਨ ਕਰਦੀ ਹੈ। ਇਹ C++ "
"ਅਤੇ Modula-3 ਵਿੱਚ ਮਿਲਣ ਵਾਲੀਆਂ ਕਲਾਸ ਪ੍ਰਣਾਲੀਆਂ ਦਾ ਮਿਲਾਪ ਹੈ। Python ਦੀਆਂ "
"ਕਲਾਸਾਂ ਆਬਜੈਕਟ-ਓਰੀਐਂਟਿਡ ਪ੍ਰੋਗਰਾਮਿੰਗ ਦੀਆਂ ਸਾਰੀਆਂ ਮਿਆਰੀ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ "
"ਪ੍ਰਦਾਨ ਕਰਦੀਆਂ ਹਨ। ਕਲਾਸ ਇਨਹੈਰਿਟੈਂਸ ਪ੍ਰਣਾਲੀ ਕਈ ਬੇਸ ਕਲਾਸਾਂ ਦੀ ਆਗਿਆ ਦਿੰਦੀ "
"ਹੈ, ਡਿਰਾਈਵਡ ਕਲਾਸ ਆਪਣੀ ਬੇਸ ਕਲਾਸ ਜਾਂ ਕਲਾਸਾਂ ਦੀਆਂ ਕਿਸੇ ਵੀ ਮੈਥਡਾਂ ਨੂੰ "
"ਓਵਰਰਾਈਡ ਕਰ ਸਕਦੀ ਹੈ ਅਤੇ ਕੋਈ ਮੈਥਡ ਉਸੇ ਨਾਮ ਵਾਲੀ ਬੇਸ ਕਲਾਸ ਦੀ ਮੈਥਡ ਨੂੰ "
"ਕਾਲ ਕਰ ਸਕਦੀ ਹੈ। ਆਬਜੈਕਟ ਕਿਸੇ ਵੀ ਮਾਤਰਾ ਅਤੇ ਕਿਸਮ ਦਾ ਡਾਟਾ ਰੱਖ ਸਕਦੇ ਹਨ। "
"ਮੌਡਿਊਲਾਂ ਵਾਂਗ, ਕਲਾਸਾਂ ਵੀ Python ਦੇ ਗਤੀਸ਼ੀਲ ਸੁਭਾਵ ਦਾ ਹਿੱਸਾ ਹਨ: ਉਹ "
"ਰਨਟਾਈਮ ਦੌਰਾਨ ਬਣਦੀਆਂ ਹਨ ਅਤੇ ਬਣਨ ਤੋਂ ਬਾਅਦ ਵੀ ਸੋਧੀਆਂ ਜਾ ਸਕਦੀਆਂ ਹਨ।"
#: ../../tutorial/classes.rst:23
msgid ""
"In C++ terminology, normally class members (including the data members) are "
"*public* (except see below :ref:`tut-private`), and all member functions are "
"*virtual*. As in Modula-3, there are no shorthands for referencing the "
"object's members from its methods: the method function is declared with an "
"explicit first argument representing the object, which is provided "
"implicitly by the call. As in Smalltalk, classes themselves are objects. "
"This provides semantics for importing and renaming. Unlike C++ and "
"Modula-3, built-in types can be used as base classes for extension by the "
"user. Also, like in C++, most built-in operators with special syntax "
"(arithmetic operators, subscripting etc.) can be redefined for class "
"instances."
msgstr ""
"C++ ਦੀ ਟਰਮੀਨੋਲੋਜੀ ਵਿੱਚ, ਆਮ ਤੌਰ 'ਤੇ ਕਲਾਸ ਮੈਂਬਰ (ਡਾਟਾ ਮੈਂਬਰ ਸਮੇਤ) "
"*public* ਹੁੰਦੇ ਹਨ (ਹੇਠਾਂ :ref:`tut-private` ਵੇਖੋ), ਅਤੇ ਸਾਰੇ ਮੈਂਬਰ "
"ਫੰਕਸ਼ਨ *virtual* ਹੁੰਦੇ ਹਨ। Modula-3 ਵਾਂਗ, ਵਿਧੀਆਂ ਦੇ ਅੰਦਰੋਂ ਆਬਜੈਕਟ ਦੇ "
"ਮੈਂਬਰਾਂ ਨੂੰ ਹਵਾਲਾ ਦੇਣ ਲਈ ਕੋਈ ਸੰਖੇਪ ਰੂਪ ਨਹੀਂ ਹੈ। ਮੈਥਡ ਫੰਕਸ਼ਨ ਨੂੰ "
"ਆਬਜੈਕਟ ਨੂੰ ਦਰਸਾਉਂਦੇ ਇੱਕ ਸਪਸ਼ਟ ਪਹਿਲੇ ਆਰਗੂਮੈਂਟ ਨਾਲ ਘੋਸ਼ਿਤ ਕੀਤਾ ਜਾਂਦਾ ਹੈ, "
"ਜੋ ਕਾਲ ਵੇਲੇ ਆਪਣੇ ਆਪ ਪ੍ਰਦਾਨ ਕੀਤਾ ਜਾਂਦਾ ਹੈ। Smalltalk ਵਾਂਗ, ਕਲਾਸਾਂ ਖੁਦ ਵੀ "
"ਆਬਜੈਕਟ ਹੁੰਦੀਆਂ ਹਨ। ਇਹ ਇੰਪੋਰਟ ਅਤੇ ਰੀਨੇਮਿੰਗ ਲਈ ਅਰਥਾਤਮਕ ਸਮਰਥਨ ਪ੍ਰਦਾਨ ਕਰਦਾ "
"ਹੈ। C++ ਅਤੇ Modula-3 ਤੋਂ ਵੱਖਰਾ, ਬਿਲਟ-ਇਨ ਟਾਈਪਾਂ ਨੂੰ ਯੂਜ਼ਰ ਦੁਆਰਾ "
"ਐਕਸਟੈਂਸ਼ਨ ਲਈ ਬੇਸ ਕਲਾਸ ਵਜੋਂ ਵਰਤਿਆ ਜਾ ਸਕਦਾ ਹੈ। ਇਸ ਤੋਂ ਇਲਾਵਾ, C++ ਵਾਂਗ "
"ਖਾਸ ਸਿੰਟੈਕਸ ਵਾਲੇ ਬਹੁਤੇ ਬਿਲਟ-ਇਨ ਓਪਰੇਟਰ (ਅੰਕਗਣਿਤ ਓਪਰੇਟਰ, ਸਬਸਕ੍ਰਿਪਟਿੰਗ ਆਦਿ) "
"ਕਲਾਸ ਇੰਸਟੈਂਸਾਂ ਲਈ ਮੁੜ ਪਰਿਭਾਸ਼ਿਤ ਕੀਤੇ ਜਾ ਸਕਦੇ ਹਨ।"
#: ../../tutorial/classes.rst:34
msgid ""
"(Lacking universally accepted terminology to talk about classes, I will make "
"occasional use of Smalltalk and C++ terms. I would use Modula-3 terms, "
"since its object-oriented semantics are closer to those of Python than C++, "
"but I expect that few readers have heard of it.)"
msgstr ""
"(ਕਲਾਸਾਂ ਬਾਰੇ ਗੱਲ ਕਰਨ ਲਈ ਕੋਈ ਸਰਵਮਾਨਯ ਟਰਮੀਨੋਲੋਜੀ ਨਾ ਹੋਣ ਕਰਕੇ, ਮੈਂ ਕਦੇ-ਕਦੇ "
"Smalltalk ਅਤੇ C++ ਦੇ ਸ਼ਬਦ ਵਰਤਾਂਗਾ। ਮੈਂ Modula-3 ਦੇ ਸ਼ਬਦ ਵਰਤ ਸਕਦਾ ਸੀ "
"ਕਿਉਂਕਿ ਇਸਦੇ ਆਬਜੈਕਟ-ਓਰੀਐਂਟਿਡ ਨਿਯਮ C++ ਨਾਲੋਂ Python ਦੇ ਵਧੇਰੇ ਨੇੜੇ ਹਨ, "
"ਪਰ ਮੈਨੂੰ ਲੱਗਦਾ ਹੈ ਕਿ ਬਹੁਤ ਘੱਟ ਪਾਠਕਾਂ ਨੇ ਇਸ ਬਾਰੇ ਸੁਣਿਆ ਹੋਵੇਗਾ।)"
#: ../../tutorial/classes.rst:43
msgid "A Word About Names and Objects"
msgstr "ਨਾਂਵਾਂ ਅਤੇ ਆਬਜੈਕਟਾਂ ਬਾਰੇ ਇੱਕ ਗੱਲ"
#: ../../tutorial/classes.rst:45
msgid ""
"Objects have individuality, and multiple names (in multiple scopes) can be "
"bound to the same object. This is known as aliasing in other languages. "
"This is usually not appreciated on a first glance at Python, and can be "
"safely ignored when dealing with immutable basic types (numbers, strings, "
"tuples). However, aliasing has a possibly surprising effect on the "
"semantics of Python code involving mutable objects such as lists, "
"dictionaries, and most other types. This is usually used to the benefit of "
"the program, since aliases behave like pointers in some respects. For "
"example, passing an object is cheap since only a pointer is passed by the "
"implementation; and if a function modifies an object passed as an argument, "
"the caller will see the change --- this eliminates the need for two "
"different argument passing mechanisms as in Pascal."
msgstr ""
"ਆਬਜੈਕਟਾਂ ਦੀ ਆਪਣੀ ਵੱਖਰੀ ਪਛਾਣ ਹੁੰਦੀ ਹੈ ਅਤੇ ਇੱਕੋ ਆਬਜੈਕਟ ਨਾਲ ਕਈ ਨਾਮ "
"(ਵੱਖ-ਵੱਖ ਸਕੋਪਾਂ ਵਿੱਚ) ਜੋੜੇ ਜਾ ਸਕਦੇ ਹਨ। ਹੋਰ ਭਾਸ਼ਾਵਾਂ ਵਿੱਚ ਇਸਨੂੰ aliasing "
"ਕਿਹਾ ਜਾਂਦਾ ਹੈ। Python ਨੂੰ ਪਹਿਲੀ ਵਾਰ ਦੇਖਣ 'ਤੇ ਇਹ ਗੱਲ ਆਮ ਤੌਰ 'ਤੇ ਧਿਆਨ "
"ਨਹੀਂ ਆਉਂਦੀ ਅਤੇ immutable ਬੁਨਿਆਦੀ ਟਾਈਪਾਂ (ਨੰਬਰ, ਸਟ੍ਰਿੰਗ, ਟਿਊਪਲ) ਨਾਲ "
"ਕੰਮ ਕਰਦੇ ਸਮੇਂ ਇਸਨੂੰ ਅਣਡਿੱਠਾ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। ਪਰ mutable ਆਬਜੈਕਟਾਂ ਜਿਵੇਂ "
"ਲਿਸਟਾਂ, ਡਿਕਸ਼ਨਰੀਆਂ ਅਤੇ ਹੋਰ ਬਹੁਤ ਸਾਰੀਆਂ ਟਾਈਪਾਂ ਨਾਲ aliasing Python ਕੋਡ "
"ਦੇ ਵਿਵਹਾਰ ਉੱਤੇ ਹੈਰਾਨੀਜਨਕ ਪ੍ਰਭਾਵ ਪਾ ਸਕਦੀ ਹੈ। ਇਹ ਅਕਸਰ ਪ੍ਰੋਗਰਾਮ ਦੇ ਹੱਕ ਵਿੱਚ "
"ਕੰਮ ਕਰਦੀ ਹੈ ਕਿਉਂਕਿ aliases ਕੁਝ ਹੱਦ ਤੱਕ pointers ਵਾਂਗ ਵਰਤਾਓ ਕਰਦੇ ਹਨ। "
"ਉਦਾਹਰਨ ਲਈ, ਕਿਸੇ ਆਬਜੈਕਟ ਨੂੰ ਆਰਗੂਮੈਂਟ ਵਜੋਂ ਪਾਸ ਕਰਨਾ ਸਸਤਾ ਹੁੰਦਾ ਹੈ ਕਿਉਂਕਿ "
"ਅਸਲ ਵਿੱਚ ਸਿਰਫ਼ pointer ਪਾਸ ਕੀਤਾ ਜਾਂਦਾ ਹੈ। ਜੇ ਕੋਈ ਫੰਕਸ਼ਨ ਆਰਗੂਮੈਂਟ ਵਜੋਂ "
"ਮਿਲੇ ਆਬਜੈਕਟ ਵਿੱਚ ਤਬਦੀਲੀ ਕਰੇ, ਤਾਂ ਕਾਲ ਕਰਨ ਵਾਲੇ ਨੂੰ ਵੀ ਉਹ ਤਬਦੀਲੀ ਦਿਖਾਈ "
"ਦੇਵੇਗੀ। ਇਸ ਤਰ੍ਹਾਂ Pascal ਵਾਂਗ ਦੋ ਵੱਖਰੇ argument passing ਤਰੀਕਿਆਂ ਦੀ "
"ਲੋੜ ਨਹੀਂ ਰਹਿੰਦੀ।"
#: ../../tutorial/classes.rst:61
msgid "Python Scopes and Namespaces"
msgstr "Python ਵਿੱਚ ਸਕੋਪ ਅਤੇ ਨੇਮਸਪੇਸ"
#: ../../tutorial/classes.rst:63
msgid ""
"Before introducing classes, I first have to tell you something about "
"Python's scope rules. Class definitions play some neat tricks with "
"namespaces, and you need to know how scopes and namespaces work to fully "
"understand what's going on. Incidentally, knowledge about this subject is "
"useful for any advanced Python programmer."
msgstr ""
"ਕਲਾਸਾਂ ਦੀ ਜਾਣ-ਪਛਾਣ ਕਰਵਾਉਣ ਤੋਂ ਪਹਿਲਾਂ, ਮੈਨੂੰ ਤੁਹਾਨੂੰ Python ਦੇ ਸਕੋਪ ਨਿਯਮਾਂ "
"ਬਾਰੇ ਕੁਝ ਦੱਸਣਾ ਪਵੇਗਾ। ਕਲਾਸ ਪਰਿਭਾਸ਼ਾਵਾਂ ਨੇਮਸਪੇਸ ਨਾਲ ਕੁਝ ਦਿਲਚਸਪ ਤਰੀਕੇ ਨਾਲ ਕੰਮ "
"ਕਰਦੀਆਂ ਹਨ, ਅਤੇ ਜੋ ਕੁਝ ਹੋ ਰਿਹਾ ਹੈ ਉਸਨੂੰ ਪੂਰੀ ਤਰ੍ਹਾਂ ਸਮਝਣ ਲਈ ਤੁਹਾਨੂੰ ਸਕੋਪ ਅਤੇ "
"ਨੇਮਸਪੇਸ ਦੀ ਕਾਰਵਾਈ ਨੂੰ ਜਾਣਨਾ ਲਾਜ਼ਮੀ ਹੈ। ਇਸ ਤੋਂ ਇਲਾਵਾ, ਇਸ ਵਿਸ਼ੇ ਬਾਰੇ ਗਿਆਨ "
"ਕਿਸੇ ਵੀ ਉੱਨਤ Python ਪ੍ਰੋਗਰਾਮਰ ਲਈ ਲਾਭਦਾਇਕ ਹੈ।"
#: ../../tutorial/classes.rst:69
msgid "Let's begin with some definitions."
msgstr "ਆਓ ਕੁਝ ਪਰਿਭਾਸ਼ਾਵਾਂ ਨਾਲ ਸ਼ੁਰੂ ਕਰੀਏ।"
#: ../../tutorial/classes.rst:71
msgid ""
"A *namespace* is a mapping from names to objects. Most namespaces are "
"currently implemented as Python dictionaries, but that's normally not "
"noticeable in any way (except for performance), and it may change in the "
"future. Examples of namespaces are: the set of built-in names (containing "
"functions such as :func:`abs`, and built-in exception names); the global "
"names in a module; and the local names in a function invocation. In a sense "
"the set of attributes of an object also form a namespace. The important "
"thing to know about namespaces is that there is absolutely no relation "
"between names in different namespaces; for instance, two different modules "
"may both define a function ``maximize`` without confusion --- users of the "
"modules must prefix it with the module name."
msgstr ""
"ਇੱਕ *ਨੇਮਸਪੇਸ* ਨਾਮਾਂ ਅਤੇ ਆਬਜੈਕਟਾਂ ਵਿਚਕਾਰ ਇੱਕ ਮੈਪਿੰਗ ਹੁੰਦੀ ਹੈ। ਜ਼ਿਆਦਾਤਰ "
"ਨੇਮਸਪੇਸ ਇਸ ਸਮੇਂ Python ਡਿਕਸ਼ਨਰੀਆਂ ਰਾਹੀਂ ਲਾਗੂ ਕੀਤੇ ਜਾਂਦੇ ਹਨ, ਪਰ ਇਹ ਗੱਲ ਆਮ "
"ਤੌਰ 'ਤੇ ਦਿਖਾਈ ਨਹੀਂ ਦਿੰਦੀ (ਕਾਰਗੁਜ਼ਾਰੀ ਤੋਂ ਇਲਾਵਾ) ਅਤੇ ਭਵਿੱਖ ਵਿੱਚ ਬਦਲ ਵੀ ਸਕਦੀ "
"ਹੈ। ਨੇਮਸਪੇਸਾਂ ਦੇ ਉਦਾਹਰਨ ਹਨ: ਬਿਲਟ-ਇਨ ਨਾਮਾਂ ਦਾ ਸਮੂਹ (ਜਿਸ ਵਿੱਚ :func:`abs` "
"ਵਰਗੇ ਫੰਕਸ਼ਨ ਅਤੇ ਬਿਲਟ-ਇਨ ਐਕਸੈਪਸ਼ਨ ਨਾਮ ਸ਼ਾਮਲ ਹਨ), ਕਿਸੇ ਮੌਡਿਊਲ ਦੇ ਗਲੋਬਲ ਨਾਮ, "
"ਅਤੇ ਕਿਸੇ ਫੰਕਸ਼ਨ ਕਾਲ ਦੇ ਸਥਾਨਕ ਨਾਮ। ਇੱਕ ਅਰਥ ਵਿੱਚ, ਕਿਸੇ ਆਬਜੈਕਟ ਦੇ ਐਟ੍ਰਿਬਿਊਟਾਂ "
"ਦਾ ਸਮੂਹ ਵੀ ਇੱਕ ਨੇਮਸਪੇਸ ਬਣਾਉਂਦਾ ਹੈ। ਨੇਮਸਪੇਸਾਂ ਬਾਰੇ ਸਭ ਤੋਂ ਮਹੱਤਵਪੂਰਨ ਗੱਲ ਇਹ "
"ਹੈ ਕਿ ਵੱਖ-ਵੱਖ ਨੇਮਸਪੇਸਾਂ ਦੇ ਨਾਮਾਂ ਵਿਚਕਾਰ ਕੋਈ ਸਿੱਧਾ ਸੰਬੰਧ ਨਹੀਂ ਹੁੰਦਾ। "
"ਉਦਾਹਰਨ ਵਜੋਂ, ਦੋ ਵੱਖਰੇ ਮੌਡਿਊਲ ``maximize`` ਨਾਮ ਦਾ ਫੰਕਸ਼ਨ ਪਰਿਭਾਸ਼ਿਤ ਕਰ ਸਕਦੇ "
"ਹਨ ਅਤੇ ਕੋਈ ਉਲਝਣ ਨਹੀਂ ਹੁੰਦੀ — ਵਰਤੋਂਕਾਰਾਂ ਨੂੰ ਮੌਡਿਊਲ ਦੇ ਨਾਮ ਨਾਲ ਇਸਦਾ ਹਵਾਲਾ "
"ਦੇਣਾ ਪੈਂਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:82
msgid ""
"By the way, I use the word *attribute* for any name following a dot --- for "
"example, in the expression ``z.real``, ``real`` is an attribute of the "
"object ``z``. Strictly speaking, references to names in modules are "
"attribute references: in the expression ``modname.funcname``, ``modname`` is "
"a module object and ``funcname`` is an attribute of it. In this case there "
"happens to be a straightforward mapping between the module's attributes and "
"the global names defined in the module: they share the same namespace! [#]_"
msgstr ""
"ਵੈਸੇ, ਮੈਂ ਡੌਟ ਤੋਂ ਬਾਅਦ ਆਉਣ ਵਾਲੇ ਕਿਸੇ ਵੀ ਨਾਮ ਲਈ *ਐਟ੍ਰਿਬਿਊਟ* ਸ਼ਬਦ ਵਰਤਦਾ ਹਾਂ। "
"ਉਦਾਹਰਨ ਵਜੋਂ, ``z.real`` ਐਕਸਪ੍ਰੈਸ਼ਨ ਵਿੱਚ ``real`` ਆਬਜੈਕਟ ``z`` ਦਾ ਇੱਕ "
"ਐਟ੍ਰਿਬਿਊਟ ਹੈ। ਸਖ਼ਤੀ ਨਾਲ ਕਹੀਏ ਤਾਂ ਮੌਡਿਊਲਾਂ ਵਿੱਚ ਨਾਮਾਂ ਦੇ ਹਵਾਲੇ ਵੀ ਐਟ੍ਰਿਬਿਊਟ "
"ਹਵਾਲੇ ਹੀ ਹੁੰਦੇ ਹਨ। ``modname.funcname`` ਵਿੱਚ ``modname`` ਇੱਕ ਮੌਡਿਊਲ "
"ਆਬਜੈਕਟ ਹੈ ਅਤੇ ``funcname`` ਉਸਦਾ ਐਟ੍ਰਿਬਿਊਟ ਹੈ। ਇਸ ਮਾਮਲੇ ਵਿੱਚ ਮੌਡਿਊਲ ਦੇ "
"ਐਟ੍ਰਿਬਿਊਟਾਂ ਅਤੇ ਉਸ ਵਿੱਚ ਪਰਿਭਾਸ਼ਿਤ ਗਲੋਬਲ ਨਾਮਾਂ ਵਿਚਕਾਰ ਸਿੱਧੀ ਮੈਪਿੰਗ ਹੁੰਦੀ ਹੈ "
"ਅਤੇ ਉਹ ਇੱਕੋ ਨੇਮਸਪੇਸ ਸਾਂਝਾ ਕਰਦੇ ਹਨ। [#]_"
#: ../../tutorial/classes.rst:90
msgid ""
"Attributes may be read-only or writable. In the latter case, assignment to "
"attributes is possible. Module attributes are writable: you can write "
"``modname.the_answer = 42``. Writable attributes may also be deleted with "
"the :keyword:`del` statement. For example, ``del modname.the_answer`` will "
"remove the attribute :attr:`!the_answer` from the object named by "
"``modname``."
msgstr ""
"ਐਟ੍ਰਿਬਿਊਟ ਸਿਰਫ਼-ਪੜ੍ਹਨਯੋਗ (read-only) ਜਾਂ ਲਿਖਣਯੋਗ (writable) ਹੋ ਸਕਦੇ ਹਨ। "
"ਲਿਖਣਯੋਗ ਐਟ੍ਰਿਬਿਊਟਾਂ ਨੂੰ ਮੁੱਲ ਅਸਾਈਨ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। ਮੌਡਿਊਲ ਐਟ੍ਰਿਬਿਊਟ "
"ਲਿਖਣਯੋਗ ਹੁੰਦੇ ਹਨ, ਉਦਾਹਰਨ ਵਜੋਂ ਤੁਸੀਂ ``modname.the_answer = 42`` ਲਿਖ ਸਕਦੇ "
"ਹੋ। ਲਿਖਣਯੋਗ ਐਟ੍ਰਿਬਿਊਟਾਂ ਨੂੰ :keyword:`del` ਸਟੇਟਮੈਂਟ ਨਾਲ ਹਟਾਇਆ ਵੀ ਜਾ ਸਕਦਾ "
"ਹੈ। ਉਦਾਹਰਨ ਲਈ, ``del modname.the_answer`` ``modname`` ਨਾਮਕ ਆਬਜੈਕਟ ਤੋਂ "
":attr:`!the_answer` ਐਟ੍ਰਿਬਿਊਟ ਨੂੰ ਹਟਾ ਦੇਵੇਗਾ।"
#: ../../tutorial/classes.rst:96
msgid ""
"Namespaces are created at different moments and have different lifetimes. "
"The namespace containing the built-in names is created when the Python "
"interpreter starts up, and is never deleted. The global namespace for a "
"module is created when the module definition is read in; normally, module "
"namespaces also last until the interpreter quits. The statements executed "
"by the top-level invocation of the interpreter, either read from a script "
"file or interactively, are considered part of a module called :mod:"
"`__main__`, so they have their own global namespace. (The built-in names "
"actually also live in a module; this is called :mod:`builtins`.)"
msgstr ""
"ਨੇਮਸਪੇਸ ਵੱਖ-ਵੱਖ ਸਮਿਆਂ 'ਤੇ ਬਣਾਏ ਜਾਂਦੇ ਹਨ ਅਤੇ ਉਨ੍ਹਾਂ ਦੀ ਉਮਰ ਵੀ ਵੱਖਰੀ ਹੁੰਦੀ "
"ਹੈ। ਬਿਲਟ-ਇਨ ਨਾਮਾਂ ਵਾਲਾ ਨੇਮਸਪੇਸ Python ਇੰਟਰਪ੍ਰੀਟਰ ਦੇ ਸ਼ੁਰੂ ਹੋਣ ਸਮੇਂ ਬਣਦਾ ਹੈ "
"ਅਤੇ ਕਦੇ ਮਿਟਾਇਆ ਨਹੀਂ ਜਾਂਦਾ। ਕਿਸੇ ਮੌਡਿਊਲ ਦਾ ਗਲੋਬਲ ਨੇਮਸਪੇਸ ਮੌਡਿਊਲ ਦੀ ਪਰਿਭਾਸ਼ਾ "
"ਪੜ੍ਹੇ ਜਾਣ ਸਮੇਂ ਬਣਦਾ ਹੈ ਅਤੇ ਆਮ ਤੌਰ 'ਤੇ ਇੰਟਰਪ੍ਰੀਟਰ ਬੰਦ ਹੋਣ ਤੱਕ ਮੌਜੂਦ ਰਹਿੰਦਾ "
"ਹੈ। ਇੰਟਰਪ੍ਰੀਟਰ ਦੇ ਉੱਚ-ਪੱਧਰੀ ਚਲਾਓ ਦੌਰਾਨ ਚਲਣ ਵਾਲੀਆਂ ਸਟੇਟਮੈਂਟਾਂ, ਭਾਵੇਂ ਉਹ "
"ਸਕ੍ਰਿਪਟ ਫਾਈਲ ਤੋਂ ਪੜ੍ਹੀਆਂ ਗਈਆਂ ਹੋਣ ਜਾਂ ਇੰਟਰਐਕਟਿਵ ਤਰੀਕੇ ਨਾਲ, :mod:`__main__` "
"ਨਾਮਕ ਮੌਡਿਊਲ ਦਾ ਹਿੱਸਾ ਮੰਨੀਆਂ ਜਾਂਦੀਆਂ ਹਨ, ਇਸ ਲਈ ਉਹਨਾਂ ਦਾ ਆਪਣਾ ਗਲੋਬਲ "
"ਨੇਮਸਪੇਸ ਹੁੰਦਾ ਹੈ। (ਬਿਲਟ-ਇਨ ਨਾਮ ਅਸਲ ਵਿੱਚ :mod:`builtins` ਮੌਡਿਊਲ ਵਿੱਚ "
"ਮੌਜੂਦ ਹੁੰਦੇ ਹਨ।)"
#: ../../tutorial/classes.rst:106
msgid ""
"The local namespace for a function is created when the function is called, "
"and deleted when the function returns or raises an exception that is not "
"handled within the function. (Actually, forgetting would be a better way to "
"describe what actually happens.) Of course, recursive invocations each have "
"their own local namespace."
msgstr ""
"ਕਿਸੇ ਫੰਕਸ਼ਨ ਦਾ ਸਥਾਨਕ ਨੇਮਸਪੇਸ ਉਸ ਵੇਲੇ ਬਣਦਾ ਹੈ ਜਦੋਂ ਫੰਕਸ਼ਨ ਕਾਲ ਕੀਤਾ ਜਾਂਦਾ ਹੈ "
"ਅਤੇ ਜਦੋਂ ਫੰਕਸ਼ਨ ਮੁੜਦਾ ਹੈ ਜਾਂ ਕੋਈ ਐਸੀ ਐਕਸੈਪਸ਼ਨ ਪੈਦਾ ਕਰਦਾ ਹੈ ਜੋ ਫੰਕਸ਼ਨ ਦੇ ਅੰਦਰ "
"ਹੈਂਡਲ ਨਹੀਂ ਕੀਤੀ ਗਈ, ਤਾਂ ਇਹ ਮਿਟ ਜਾਂਦਾ ਹੈ। (ਅਸਲ ਵਿੱਚ, 'ਭੁੱਲ ਜਾਣਾ' ਇਸ ਪ੍ਰਕਿਰਿਆ "
"ਦਾ ਵਧੀਆ ਵਰਣਨ ਹੈ।) ਬੇਸ਼ੱਕ, ਹਰ ਰਿਕਰਸਿਵ ਕਾਲ ਦਾ ਆਪਣਾ ਵੱਖਰਾ ਸਥਾਨਕ ਨੇਮਸਪੇਸ ਹੁੰਦਾ "
"ਹੈ।"
#: ../../tutorial/classes.rst:112
msgid ""
"A *scope* is a textual region of a Python program where a namespace is "
"directly accessible. \"Directly accessible\" here means that an unqualified "
"reference to a name attempts to find the name in the namespace."
msgstr ""
"ਇੱਕ *ਸਕੋਪ* Python ਪ੍ਰੋਗਰਾਮ ਦਾ ਉਹ ਪਾਠਕ ਖੇਤਰ ਹੁੰਦਾ ਹੈ ਜਿੱਥੇ ਇੱਕ ਨੇਮਸਪੇਸ ਤੱਕ "
"ਸਿੱਧੀ ਪਹੁੰਚ ਹੁੰਦੀ ਹੈ। ਇੱਥੇ \"ਸਿੱਧੀ ਪਹੁੰਚ\" ਦਾ ਅਰਥ ਹੈ ਕਿ ਕਿਸੇ ਨਾਂ ਦੇ ਬਿਨਾਂ "
"ਯੋਗਤਾ ਵਾਲੇ ਹਵਾਲੇ ਦੁਆਰਾ ਉਸ ਨਾਂ ਨੂੰ ਨੇਮਸਪੇਸ ਵਿੱਚ ਲੱਭਣ ਦੀ ਕੋਸ਼ਿਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ।"
#: ../../tutorial/classes.rst:116
msgid ""
"Although scopes are determined statically, they are used dynamically. At any "
"time during execution, there are 3 or 4 nested scopes whose namespaces are "
"directly accessible:"
msgstr ""
"ਹਾਲਾਂਕਿ ਸਕੋਪਾਂ ਦਾ ਨਿਰਧਾਰਣ ਸਥਿਰ (statically) ਤਰੀਕੇ ਨਾਲ ਹੁੰਦਾ ਹੈ, ਪਰ "
"ਉਹਨਾਂ ਦੀ ਵਰਤੋਂ ਗਤੀਸ਼ੀਲ (dynamically) ਤਰੀਕੇ ਨਾਲ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। "
"ਐਗਜ਼ਿਕਿਊਸ਼ਨ ਦੇ ਕਿਸੇ ਵੀ ਸਮੇਂ 3 ਜਾਂ 4 ਨੇਸਟਡ ਸਕੋਪ ਹੁੰਦੇ ਹਨ ਜਿਨ੍ਹਾਂ ਦੇ "
"ਨੇਮਸਪੇਸ ਸਿੱਧੇ ਤੌਰ 'ਤੇ ਪਹੁੰਚਯੋਗ ਹੁੰਦੇ ਹਨ:"
#: ../../tutorial/classes.rst:120
msgid "the innermost scope, which is searched first, contains the local names"
msgstr "ਸਭ ਤੋਂ ਅੰਦਰਲਾ ਸਕੋਪ, ਜਿਸ ਦੀ ਪਹਿਲਾਂ ਖੋਜ ਕੀਤੀ ਜਾਂਦੀ ਹੈ, ਸਥਾਨਕ ਨਾਂਵਾਂ ਨੂੰ ਰੱਖਦਾ ਹੈ"
#: ../../tutorial/classes.rst:121
msgid ""
"the scopes of any enclosing functions, which are searched starting with the "
"nearest enclosing scope, contain non-local, but also non-global names"
msgstr ""
"ਘੇਰਨ ਵਾਲੇ ਫੰਕਸ਼ਨਾਂ ਦੇ ਸਕੋਪ, ਜਿਨ੍ਹਾਂ ਦੀ ਖੋਜ ਸਭ ਤੋਂ ਨੇੜਲੇ ਸਕੋਪ ਤੋਂ ਸ਼ੁਰੂ ਹੁੰਦੀ "
"ਹੈ, ਗੈਰ-ਸਥਾਨਕ ਪਰ ਗੈਰ-ਗਲੋਬਲ ਨਾਂਵਾਂ ਨੂੰ ਰੱਖਦੇ ਹਨ"
#: ../../tutorial/classes.rst:123
msgid "the next-to-last scope contains the current module's global names"
msgstr "ਆਖਰੀ ਤੋਂ ਪਹਿਲਾਂ ਵਾਲਾ ਸਕੋਪ ਮੌਜੂਦਾ ਮੌਡਿਊਲ ਦੇ ਗਲੋਬਲ ਨਾਂਵਾਂ ਨੂੰ ਰੱਖਦਾ ਹੈ"
#: ../../tutorial/classes.rst:124
msgid ""
"the outermost scope (searched last) is the namespace containing built-in "
"names"
msgstr ""
"ਸਭ ਤੋਂ ਬਾਹਰਲਾ ਸਕੋਪ (ਜਿਸ ਦੀ ਖੋਜ ਸਭ ਤੋਂ ਆਖਿਰ ਵਿੱਚ ਹੁੰਦੀ ਹੈ) ਬਿਲਟ-ਇਨ ਨਾਂਵਾਂ "
"ਵਾਲਾ ਨੇਮਸਪੇਸ ਹੁੰਦਾ ਹੈ"
#: ../../tutorial/classes.rst:126
msgid ""
"If a name is declared global, then all references and assignments go "
"directly to the next-to-last scope containing the module's global names. To "
"rebind variables found outside of the innermost scope, the :keyword:"
"`nonlocal` statement can be used; if not declared nonlocal, those variables "
"are read-only (an attempt to write to such a variable will simply create a "
"*new* local variable in the innermost scope, leaving the identically named "
"outer variable unchanged)."
msgstr ""
"ਜੇ ਕਿਸੇ ਨਾਮ ਨੂੰ global ਘੋਸ਼ਿਤ ਕੀਤਾ ਗਿਆ ਹੋਵੇ, ਤਾਂ ਉਸ ਨਾਮ ਨਾਲ ਸੰਬੰਧਿਤ ਸਾਰੇ "
"ਹਵਾਲੇ ਅਤੇ ਅਸਾਈਨਮੈਂਟ ਸਿੱਧੇ ਮੌਡਿਊਲ ਦੇ ਗਲੋਬਲ ਨਾਮਾਂ ਵਾਲੇ ਸਕੋਪ ਵਿੱਚ ਜਾਂਦੇ ਹਨ। "
"ਸਭ ਤੋਂ ਅੰਦਰਲੇ ਸਕੋਪ ਤੋਂ ਬਾਹਰ ਮੌਜੂਦ ਵੇਰੀਏਬਲਾਂ ਨੂੰ ਮੁੜ ਬਾਈਂਡ ਕਰਨ ਲਈ "
":keyword:`nonlocal` ਸਟੇਟਮੈਂਟ ਵਰਤੀ ਜਾ ਸਕਦੀ ਹੈ। ਜੇਕਰ ਉਹਨਾਂ ਨੂੰ nonlocal "
"ਘੋਸ਼ਿਤ ਨਾ ਕੀਤਾ ਗਿਆ ਹੋਵੇ, ਤਾਂ ਉਹ ਸਿਰਫ਼-ਪੜ੍ਹਨਯੋਗ ਰਹਿੰਦੇ ਹਨ। ਅਜਿਹੇ ਵੇਰੀਏਬਲ ਵਿੱਚ "
"ਲਿਖਣ ਦੀ ਕੋਸ਼ਿਸ਼ ਕਰਨ ਨਾਲ ਅੰਦਰਲੇ ਸਕੋਪ ਵਿੱਚ ਇੱਕ *ਨਵਾਂ* ਸਥਾਨਕ ਵੇਰੀਏਬਲ ਬਣ ਜਾਂਦਾ "
"ਹੈ ਅਤੇ ਬਾਹਰਲੇ ਸਕੋਪ ਵਾਲਾ ਵੇਰੀਏਬਲ ਅਣਬਦਲਿਆ ਰਹਿੰਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:133
msgid ""
"Usually, the local scope references the local names of the (textually) "
"current function. Outside functions, the local scope references the same "
"namespace as the global scope: the module's namespace. Class definitions "
"place yet another namespace in the local scope."
msgstr ""
"ਆਮ ਤੌਰ 'ਤੇ ਸਥਾਨਕ ਸਕੋਪ ਮੌਜੂਦਾ ਫੰਕਸ਼ਨ ਦੇ ਸਥਾਨਕ ਨਾਮਾਂ ਦਾ ਹਵਾਲਾ ਦਿੰਦਾ ਹੈ। "
"ਫੰਕਸ਼ਨਾਂ ਤੋਂ ਬਾਹਰ, ਸਥਾਨਕ ਸਕੋਪ ਅਤੇ ਗਲੋਬਲ ਸਕੋਪ ਇੱਕੋ ਨੇਮਸਪੇਸ, ਅਰਥਾਤ ਮੌਡਿਊਲ ਦੇ "
"ਨੇਮਸਪੇਸ, ਨੂੰ ਦਰਸਾਉਂਦੇ ਹਨ। ਕਲਾਸ ਪਰਿਭਾਸ਼ਾਵਾਂ ਸਥਾਨਕ ਸਕੋਪ ਵਿੱਚ ਇੱਕ ਹੋਰ "
"ਨੇਮਸਪੇਸ ਸ਼ਾਮਲ ਕਰਦੀਆਂ ਹਨ।"
#: ../../tutorial/classes.rst:138
msgid ""
"It is important to realize that scopes are determined textually..."
msgstr ""
"ਇਹ ਸਮਝਣਾ ਮਹੱਤਵਪੂਰਨ ਹੈ ਕਿ ਸਕੋਪਾਂ ਦਾ ਨਿਰਧਾਰਣ ਪਾਠਕ (textual) ਤਰੀਕੇ ਨਾਲ ਹੁੰਦਾ "
"ਹੈ। ਕਿਸੇ ਮੌਡਿਊਲ ਵਿੱਚ ਪਰਿਭਾਸ਼ਿਤ ਫੰਕਸ਼ਨ ਦਾ ਗਲੋਬਲ ਸਕੋਪ ਹਮੇਸ਼ਾਂ ਉਸੇ ਮੌਡਿਊਲ ਦਾ "
"ਨੇਮਸਪੇਸ ਹੁੰਦਾ ਹੈ, ਭਾਵੇਂ ਫੰਕਸ਼ਨ ਕਿਤੇ ਤੋਂ ਵੀ ਜਾਂ ਕਿਸੇ ਵੀ ਉਪਨਾਮ ਰਾਹੀਂ ਕਾਲ ਕੀਤਾ "
"ਜਾਵੇ। ਦੂਜੇ ਪਾਸੇ, ਨਾਮਾਂ ਦੀ ਅਸਲ ਖੋਜ ਰਨਟਾਈਮ ਦੌਰਾਨ ਗਤੀਸ਼ੀਲ ਤਰੀਕੇ ਨਾਲ ਹੁੰਦੀ ਹੈ। "
"ਹਾਲਾਂਕਿ ਭਾਸ਼ਾ ਦੀ ਪਰਿਭਾਸ਼ਾ ਹੌਲੀ-ਹੌਲੀ ਕੰਪਾਈਲ ਸਮੇਂ ਸਥਿਰ ਨਾਮ ਹੱਲ ਵੱਲ ਵੱਧ ਰਹੀ "
"ਹੈ, ਇਸ ਲਈ ਗਤੀਸ਼ੀਲ ਨਾਮ ਹੱਲ 'ਤੇ ਨਿਰਭਰ ਨਹੀਂ ਰਹਿਣਾ ਚਾਹੀਦਾ।"
#: ../../tutorial/classes.rst:146
msgid ""
"A special quirk of Python is that -- if no :keyword:`global` or :keyword:"
"`nonlocal` statement is in effect -- assignments to names always go into the "
"innermost scope..."
msgstr ""
"Python ਦੀ ਇੱਕ ਵਿਸ਼ੇਸ਼ਤਾ ਇਹ ਹੈ ਕਿ ਜੇ :keyword:`global` ਜਾਂ "
":keyword:`nonlocal` ਸਟੇਟਮੈਂਟ ਲਾਗੂ ਨਾ ਹੋਵੇ, ਤਾਂ ਨਾਮਾਂ ਨੂੰ ਕੀਤੀਆਂ ਸਾਰੀਆਂ "
"ਅਸਾਈਨਮੈਂਟਾਂ ਹਮੇਸ਼ਾਂ ਸਭ ਤੋਂ ਅੰਦਰਲੇ ਸਕੋਪ ਵਿੱਚ ਜਾਂਦੀਆਂ ਹਨ। ਅਸਾਈਨਮੈਂਟ ਡਾਟਾ ਦੀ "
"ਕਾਪੀ ਨਹੀਂ ਬਣਾਉਂਦੀਆਂ, ਸਗੋਂ ਨਾਮਾਂ ਨੂੰ ਆਬਜੈਕਟਾਂ ਨਾਲ ਜੋੜਦੀਆਂ ਹਨ। ਇਹੀ ਗੱਲ "
"ਮਿਟਾਉਣ 'ਤੇ ਵੀ ਲਾਗੂ ਹੁੰਦੀ ਹੈ।"
#: ../../tutorial/classes.rst:154
msgid ""
"The :keyword:`global` statement can be used to indicate that particular "
"variables live in the global scope and should be rebound there; the :keyword:"
"`nonlocal` statement indicates that particular variables live in an "
"enclosing scope and should be rebound there."
msgstr ""
":keyword:`global` ਸਟੇਟਮੈਂਟ ਇਹ ਦਰਸਾਉਣ ਲਈ ਵਰਤੀ ਜਾਂਦੀ ਹੈ ਕਿ ਕੁਝ ਵੇਰੀਏਬਲ "
"ਗਲੋਬਲ ਸਕੋਪ ਵਿੱਚ ਮੌਜੂਦ ਹਨ ਅਤੇ ਉਨ੍ਹਾਂ ਨੂੰ ਉੱਥੇ ਹੀ ਮੁੜ ਬਾਈਂਡ ਕੀਤਾ ਜਾਣਾ ਚਾਹੀਦਾ "
"ਹੈ। :keyword:`nonlocal` ਸਟੇਟਮੈਂਟ ਇਹ ਦਰਸਾਉਂਦੀ ਹੈ ਕਿ ਕੁਝ ਵੇਰੀਏਬਲ ਕਿਸੇ ਘੇਰਨ "
"ਵਾਲੇ ਸਕੋਪ ਵਿੱਚ ਮੌਜੂਦ ਹਨ ਅਤੇ ਉਨ੍ਹਾਂ ਨੂੰ ਉੱਥੇ ਹੀ ਮੁੜ ਬਾਈਂਡ ਕੀਤਾ ਜਾਣਾ ਚਾਹੀਦਾ "
"ਹੈ।"
#: ../../tutorial/classes.rst:162
msgid "Scopes and Namespaces Example"
msgstr "ਸਕੋਪ ਅਤੇ ਨੇਮਸਪੇਸ ਦੀ ਉਦਾਹਰਨ"
#: ../../tutorial/classes.rst:164
msgid ""
"This is an example demonstrating how to reference the different scopes and "
"namespaces, and how :keyword:`global` and :keyword:`nonlocal` affect "
"variable binding::"
msgstr ""
"ਇਹ ਉਦਾਹਰਨ ਦਰਸਾਉਂਦੀ ਹੈ ਕਿ ਵੱਖ-ਵੱਖ ਸਕੋਪਾਂ ਅਤੇ ਨੇਮਸਪੇਸਾਂ ਦਾ ਹਵਾਲਾ ਕਿਵੇਂ ਦਿੱਤਾ "
"ਜਾਂਦਾ ਹੈ ਅਤੇ :keyword:`global` ਅਤੇ :keyword:`nonlocal` ਵੇਰੀਏਬਲ ਬਾਈਂਡਿੰਗ "
"ਨੂੰ ਕਿਵੇਂ ਪ੍ਰਭਾਵਿਤ ਕਰਦੇ ਹਨ::"
#: ../../tutorial/classes.rst:168
msgid ""
"def scope_test():\n"
" def do_local():\n"
" spam = \"local spam\"\n"
"\n"
" def do_nonlocal():\n"
" nonlocal spam\n"
" spam = \"nonlocal spam\"\n"
"\n"
" def do_global():\n"
" global spam\n"
" spam = \"global spam\"\n"
"\n"
" spam = \"test spam\"\n"
" do_local()\n"
" print(\"After local assignment:\", spam)\n"
" do_nonlocal()\n"
" print(\"After nonlocal assignment:\", spam)\n"
" do_global()\n"
" print(\"After global assignment:\", spam)\n"
"\n"
"scope_test()\n"
"print(\"In global scope:\", spam)"
msgstr ""
"def scope_test():\n"
" def do_local():\n"
" spam = \"local spam\"\n"
"\n"
" def do_nonlocal():\n"
" nonlocal spam\n"
" spam = \"nonlocal spam\"\n"
"\n"
" def do_global():\n"
" global spam\n"
" spam = \"global spam\"\n"
"\n"
" spam = \"test spam\"\n"
" do_local()\n"
" print(\"After local assignment:\", spam)\n"
" do_nonlocal()\n"
" print(\"After nonlocal assignment:\", spam)\n"
" do_global()\n"
" print(\"After global assignment:\", spam)\n"
"\n"
"scope_test()\n"
"print(\"In global scope:\", spam)"
#: ../../tutorial/classes.rst:191
msgid "The output of the example code is:"
msgstr "ਉਦਾਹਰਨ ਕੋਡ ਦਾ ਆਉਟਪੁੱਟ ਇਹ ਹੈ:"
#: ../../tutorial/classes.rst:193
msgid ""
"After local assignment: test spam\n"
"After nonlocal assignment: nonlocal spam\n"
"After global assignment: nonlocal spam\n"
"In global scope: global spam"
msgstr ""
"After local assignment: test spam\n"
"After nonlocal assignment: nonlocal spam\n"
"After global assignment: nonlocal spam\n"
"In global scope: global spam"
#: ../../tutorial/classes.rst:200
msgid ""
"Note how the *local* assignment (which is default) didn't change *scope_test*"
"\\'s binding of *spam*. The :keyword:`nonlocal` assignment changed "
"*scope_test*\\'s binding of *spam*, and the :keyword:`global` assignment "
"changed the module-level binding."
msgstr ""
"ਧਿਆਨ ਦਿਓ ਕਿ *local* ਅਸਾਈਨਮੈਂਟ (ਜੋ ਮੂਲ ਵਰਤਾਰਾ ਹੈ) ਨੇ *scope_test* ਵਿੱਚ "
"*spam* ਦੀ ਬਾਈਂਡਿੰਗ ਨਹੀਂ ਬਦਲੀ। :keyword:`nonlocal` ਅਸਾਈਨਮੈਂਟ ਨੇ "
"*scope_test* ਦੀ *spam* ਬਾਈਂਡਿੰਗ ਬਦਲ ਦਿੱਤੀ, ਜਦਕਿ :keyword:`global` "
"ਅਸਾਈਨਮੈਂਟ ਨੇ ਮੌਡਿਊਲ-ਪੱਧਰ ਦੀ ਬਾਈਂਡਿੰਗ ਬਦਲੀ।"
#: ../../tutorial/classes.rst:205
msgid ""
"You can also see that there was no previous binding for *spam* before the :"
"keyword:`global` assignment."
msgstr ""
"ਤੁਸੀਂ ਇਹ ਵੀ ਦੇਖ ਸਕਦੇ ਹੋ ਕਿ :keyword:`global` ਅਸਾਈਨਮੈਂਟ ਤੋਂ ਪਹਿਲਾਂ *spam* "
"ਲਈ ਕੋਈ ਪਿਛਲੀ ਬਾਈਂਡਿੰਗ ਮੌਜੂਦ ਨਹੀਂ ਸੀ।"
#: ../../tutorial/classes.rst:212
msgid "A First Look at Classes"
msgstr "ਕਲਾਸਾਂ ਨਾਲ ਪਹਿਲੀ ਜਾਣ-ਪਛਾਣ"
#: ../../tutorial/classes.rst:214
msgid ""
"Classes introduce a little bit of new syntax, three new object types, and "
"some new semantics."
msgstr ""
"ਕਲਾਸਾਂ ਕੁਝ ਨਵਾਂ ਸਿੰਟੈਕਸ, ਤਿੰਨ ਨਵੀਆਂ ਵਸਤੂ ਕਿਸਮਾਂ ਅਤੇ ਕੁਝ ਨਵੇਂ ਅਰਥਾਤਮਕ "
"ਨਿਯਮਾਂ ਦੀ ਜਾਣ-ਪਛਾਣ ਕਰਵਾਉਂਦੀਆਂ ਹਨ।"
#: ../../tutorial/classes.rst:221
msgid "Class Definition Syntax"
msgstr "ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਦਾ ਸਿੰਟੈਕਸ"
#: ../../tutorial/classes.rst:223
msgid "The simplest form of class definition looks like this::"
msgstr "ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਦਾ ਸਭ ਤੋਂ ਸਰਲ ਰੂਪ ਇਸ ਤਰ੍ਹਾਂ ਦਿਖਾਈ ਦਿੰਦਾ ਹੈ::"
#: ../../tutorial/classes.rst:225
msgid ""
"class ClassName:\n"
" <statement-1>\n"
" .\n"
" .\n"
" .\n"
" <statement-N>"
msgstr ""
"class ClassName:\n"
" <statement-1>\n"
" .\n"
" .\n"
" .\n"
" <statement-N>"
#: ../../tutorial/classes.rst:232
msgid ""
"Class definitions, like function definitions (:keyword:`def` statements) "
"must be executed before they have any effect. (You could conceivably place "
"a class definition in a branch of an :keyword:`if` statement, or inside a "
"function.)"
msgstr ""
"ਕਲਾਸ ਪਰਿਭਾਸ਼ਾਵਾਂ, ਫੰਕਸ਼ਨ ਪਰਿਭਾਸ਼ਾਵਾਂ (:keyword:`def` ਸਟੇਟਮੈਂਟਾਂ) ਵਾਂਗ, "
"ਕੋਈ ਪ੍ਰਭਾਵ ਪੈਦਾ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ ਚਲਾਈਆਂ ਜਾਣੀਆਂ ਲਾਜ਼ਮੀ ਹਨ।"
#: ../../tutorial/classes.rst:236
msgid ""
"In practice, the statements inside a class definition will usually be "
"function definitions, but other statements are allowed, and sometimes useful "
"--- we'll come back to this later. The function definitions inside a class "
"normally have a peculiar form of argument list, dictated by the calling "
"conventions for methods --- again, this is explained later."
msgstr ""
"ਅਮਲ ਵਿੱਚ, ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਦੇ ਅੰਦਰਲੇ ਸਟੇਟਮੈਂਟ ਆਮ ਤੌਰ 'ਤੇ ਫੰਕਸ਼ਨ ਪਰਿਭਾਸ਼ਾਵਾਂ "
"ਹੁੰਦੀਆਂ ਹਨ, ਪਰ ਹੋਰ ਸਟੇਟਮੈਂਟ ਵੀ ਮਨਜ਼ੂਰ ਹਨ ਅਤੇ ਕਈ ਵਾਰ ਲਾਭਦਾਇਕ ਵੀ ਹੁੰਦੀਆਂ "
"ਹਨ — ਇਸ ਬਾਰੇ ਅਸੀਂ ਬਾਅਦ ਵਿੱਚ ਮੁੜ ਗੱਲ ਕਰਾਂਗੇ। ਕਲਾਸ ਦੇ ਅੰਦਰਲੇ ਫੰਕਸ਼ਨ ਆਮ ਤੌਰ "
"'ਤੇ ਆਰਗੂਮੈਂਟ ਸੂਚੀ ਦੇ ਇੱਕ ਵਿਸ਼ੇਸ਼ ਰੂਪ ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਨ, ਜੋ ਵਿਧੀਆਂ ਦੀ "
"ਕਾਲਿੰਗ ਪਰੰਪਰਾ ਦੁਆਰਾ ਨਿਰਧਾਰਤ ਹੁੰਦਾ ਹੈ — ਇਸਦੀ ਵੀ ਵਿਆਖਿਆ ਅੱਗੇ ਕੀਤੀ ਜਾਵੇਗੀ।"
#: ../../tutorial/classes.rst:242
msgid ""
"When a class definition is entered, a new namespace is created, and used as "
"the local scope --- thus, all assignments to local variables go into this "
"new namespace. In particular, function definitions bind the name of the new "
"function here."
msgstr ""
"ਜਦੋਂ ਕਿਸੇ ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਵਿੱਚ ਦਾਖਲ ਹੁੰਦੇ ਹਾਂ, ਤਾਂ ਇੱਕ ਨਵਾਂ ਨੇਮਸਪੇਸ ਬਣਾਇਆ "
"ਜਾਂਦਾ ਹੈ ਅਤੇ ਇਸਨੂੰ ਸਥਾਨਕ ਸਕੋਪ ਵਜੋਂ ਵਰਤਿਆ ਜਾਂਦਾ ਹੈ। ਇਸ ਲਈ ਸਥਾਨਕ ਵੇਰੀਏਬਲਾਂ "
"ਨੂੰ ਕੀਤੀਆਂ ਸਾਰੀਆਂ ਅਸਾਈਨਮੈਂਟਾਂ ਇਸ ਨਵੇਂ ਨੇਮਸਪੇਸ ਵਿੱਚ ਜਾਂਦੀਆਂ ਹਨ।"
#: ../../tutorial/classes.rst:247
msgid ""
"When a class definition is left normally (via the end), a *class object* is "
"created. This is basically a wrapper around the contents of the namespace "
"created by the class definition; we'll learn more about class objects in the "
"next section. The original local scope (the one in effect just before the "
"class definition was entered) is reinstated, and the class object is bound "
"here to the class name given in the class definition header (:class:`!"
"ClassName` in the example)."
msgstr ""
"ਜਦੋਂ ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਆਮ ਤਰੀਕੇ ਨਾਲ ਸਮਾਪਤ ਹੁੰਦੀ ਹੈ, ਤਾਂ ਇੱਕ *ਕਲਾਸ ਆਬਜੈਕਟ* "
"ਬਣਾਇਆ ਜਾਂਦਾ ਹੈ। ਇਹ ਅਸਲ ਵਿੱਚ ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਦੁਆਰਾ ਬਣਾਏ ਗਏ ਨੇਮਸਪੇਸ ਦੀ ਸਮੱਗਰੀ "
"ਦੇ ਆਲੇ-ਦੁਆਲੇ ਇੱਕ ਰੈਪਰ ਹੁੰਦਾ ਹੈ। ਅਗਲੇ ਭਾਗ ਵਿੱਚ ਅਸੀਂ ਕਲਾਸ ਆਬਜੈਕਟਾਂ ਬਾਰੇ ਹੋਰ "
"ਸਿੱਖਾਂਗੇ। ਮੂਲ ਸਥਾਨਕ ਸਕੋਪ (ਜੋ ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਵਿੱਚ ਦਾਖਲ ਹੋਣ ਤੋਂ ਪਹਿਲਾਂ "
"ਸਰਗਰਮ ਸੀ) ਮੁੜ ਬਹਾਲ ਕੀਤਾ ਜਾਂਦਾ ਹੈ ਅਤੇ ਕਲਾਸ ਆਬਜੈਕਟ ਨੂੰ ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਦੇ "
"ਸਿਰਲੇਖ ਵਿੱਚ ਦਿੱਤੇ ਕਲਾਸ ਨਾਂ ਨਾਲ ਜੋੜਿਆ ਜਾਂਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:259
msgid "Class Objects"
msgstr "ਕਲਾਸ ਆਬਜੈਕਟ"
#: ../../tutorial/classes.rst:261
msgid ""
"Class objects support two kinds of operations: attribute references and "
"instantiation."
msgstr ""
"ਕਲਾਸ ਆਬਜੈਕਟ ਦੋ ਕਿਸਮ ਦੀਆਂ ਕਾਰਵਾਈਆਂ ਦਾ ਸਮਰਥਨ ਕਰਦੇ ਹਨ: ਐਟ੍ਰਿਬਿਊਟ ਹਵਾਲੇ "
"ਅਤੇ ਇੰਸਟੈਂਸ਼ੀਏਸ਼ਨ।"
#: ../../tutorial/classes.rst:264
msgid ""
"*Attribute references* use the standard syntax used for all attribute "
"references in Python: ``obj.name``. Valid attribute names are all the names "
"that were in the class's namespace when the class object was created. So, "
"if the class definition looked like this::"
msgstr ""
"*ਐਟ੍ਰਿਬਿਊਟ ਹਵਾਲੇ* Python ਵਿੱਚ ਸਾਰੇ ਐਟ੍ਰਿਬਿਊਟ ਹਵਾਲਿਆਂ ਲਈ ਵਰਤੇ ਜਾਣ ਵਾਲੇ "
"ਮਿਆਰੀ ਸਿੰਟੈਕਸ ``obj.name`` ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਨ। ਵੈਧ ਐਟ੍ਰਿਬਿਊਟ ਨਾਂ ਉਹ ਸਾਰੇ "
"ਨਾਂ ਹੁੰਦੇ ਹਨ ਜੋ ਕਲਾਸ ਆਬਜੈਕਟ ਬਣਾਉਣ ਵੇਲੇ ਕਲਾਸ ਦੇ ਨੇਮਸਪੇਸ ਵਿੱਚ ਮੌਜੂਦ ਸਨ। ਇਸ "
"ਲਈ, ਜੇ ਕਲਾਸ ਪਰਿਭਾਸ਼ਾ ਇਸ ਤਰ੍ਹਾਂ ਹੋਵੇ::"
#: ../../tutorial/classes.rst:269
msgid ""
"class MyClass:\n"
" \"\"\"A simple example class\"\"\"\n"
" i = 12345\n"
"\n"
" def f(self):\n"
" return 'hello world'"
msgstr ""
"class MyClass:\n"
" \"\"\"ਇੱਕ ਸਰਲ ਉਦਾਹਰਨ ਕਲਾਸ\"\"\"\n"
" i = 12345\n"
"\n"
" def f(self):\n"
" return 'hello world'"
#: ../../tutorial/classes.rst:276
msgid ""
"then ``MyClass.i`` and ``MyClass.f`` are valid attribute references, "
"returning an integer and a function object, respectively. Class attributes "
"can also be assigned to, so you can change the value of ``MyClass.i`` by "
"assignment. :attr:`~type.__doc__` is also a valid attribute, returning the "
"docstring belonging to the class: ``\"A simple example class\"``."
msgstr ""
"ਤਾਂ ``MyClass.i`` ਅਤੇ ``MyClass.f`` ਵੈਧ ਐਟ੍ਰਿਬਿਊਟ ਹਵਾਲੇ ਹਨ, ਜੋ ਕ੍ਰਮਵਾਰ "
"ਇੱਕ ਪੂਰਨ ਅੰਕ ਅਤੇ ਇੱਕ ਫੰਕਸ਼ਨ ਵਸਤੂ ਵਾਪਸ ਕਰਦੇ ਹਨ। ਕਲਾਸ ਐਟ੍ਰਿਬਿਊਟਾਂ ਨੂੰ "
"ਅਸਾਈਨ ਵੀ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ, ਇਸ ਲਈ ਤੁਸੀਂ ਅਸਾਈਨਮੈਂਟ ਰਾਹੀਂ ``MyClass.i`` ਦਾ "
"ਮੁੱਲ ਬਦਲ ਸਕਦੇ ਹੋ। :attr:`~type.__doc__` ਵੀ ਇੱਕ ਵੈਧ ਐਟ੍ਰਿਬਿਊਟ ਹੈ ਜੋ "
"ਕਲਾਸ ਨਾਲ ਸੰਬੰਧਿਤ ਡਾਕਸਟਰਿੰਗ ``\"A simple example class\"`` ਵਾਪਸ ਕਰਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:282
msgid ""
"Class *instantiation* uses function notation. Just pretend that the class "
"object is a parameterless function that returns a new instance of the class. "
"For example (assuming the above class)::"
msgstr ""
"ਕਲਾਸ *ਇੰਸਟੈਂਸ਼ੀਏਸ਼ਨ* ਫੰਕਸ਼ਨ ਨੋਟੇਸ਼ਨ ਦੀ ਵਰਤੋਂ ਕਰਦੀ ਹੈ। ਸਿਰਫ਼ ਇਹ ਮੰਨ ਲਵੋ ਕਿ "
"ਕਲਾਸ ਆਬਜੈਕਟ ਇੱਕ ਬਿਨਾਂ ਪੈਰਾਮੀਟਰ ਵਾਲਾ ਫੰਕਸ਼ਨ ਹੈ ਜੋ ਕਲਾਸ ਦਾ ਨਵਾਂ ਇੰਸਟੈਂਸ "
"ਵਾਪਸ ਕਰਦਾ ਹੈ। ਉਦਾਹਰਨ ਲਈ (ਉਪਰੋਕਤ ਕਲਾਸ ਮੰਨਦੇ ਹੋਏ)::"
#: ../../tutorial/classes.rst:286 ../../tutorial/classes.rst:303
msgid "x = MyClass()"
msgstr "x = MyClass()"
#: ../../tutorial/classes.rst:288
msgid ""
"creates a new *instance* of the class and assigns this object to the local "
"variable ``x``."
msgstr ""
"ਇਹ ਕਲਾਸ ਦਾ ਇੱਕ ਨਵਾਂ *ਇੰਸਟੈਂਸ* ਬਣਾਉਂਦਾ ਹੈ ਅਤੇ ਇਸ ਵਸਤੂ ਨੂੰ ਸਥਾਨਕ ਵੇਰੀਏਬਲ "
"``x`` ਨਾਲ ਜੋੜ ਦਿੰਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:291
msgid ""
"The instantiation operation (\"calling\" a class object) creates an empty "
"object. Many classes like to create objects with instances customized to a "
"specific initial state. Therefore a class may define a special method named :"
"meth:`~object.__init__`, like this::"
msgstr ""
"ਇੰਸਟੈਂਸ਼ੀਏਸ਼ਨ ਕਾਰਵਾਈ (ਕਲਾਸ ਆਬਜੈਕਟ ਨੂੰ \"ਕਾਲ\" ਕਰਨਾ) ਇੱਕ ਖਾਲੀ ਆਬਜੈਕਟ ਬਣਾਉਂਦੀ "
"ਹੈ। ਬਹੁਤ ਸਾਰੀਆਂ ਕਲਾਸਾਂ ਐਸੀਆਂ ਵਸਤੂਆਂ ਬਣਾਉਣਾ ਪਸੰਦ ਕਰਦੀਆਂ ਹਨ ਜਿਨ੍ਹਾਂ ਦੇ "
"ਇੰਸਟੈਂਸ ਕਿਸੇ ਖਾਸ ਸ਼ੁਰੂਆਤੀ ਸਥਿਤੀ ਅਨੁਸਾਰ ਸੰਰਚਿਤ ਕੀਤੇ ਗਏ ਹੋਣ। ਇਸ ਲਈ ਕੋਈ "
"ਕਲਾਸ :meth:`~object.__init__` ਨਾਂ ਦੀ ਇੱਕ ਵਿਸ਼ੇਸ਼ ਵਿਧੀ ਪਰਿਭਾਸ਼ਿਤ ਕਰ ਸਕਦੀ "
"ਹੈ, ਜਿਵੇਂ ਕਿ::"
#: ../../tutorial/classes.rst:296
msgid ""
"def __init__(self):\n"
" self.data = []"
msgstr ""
"def __init__(self):\n"
" self.data = []"
#: ../../tutorial/classes.rst:299
msgid ""
"When a class defines an :meth:`~object.__init__` method, class instantiation "
"automatically invokes :meth:`!__init__` for the newly created class "
"instance. So in this example, a new, initialized instance can be obtained "
"by::"
msgstr ""
"ਜਦੋਂ ਕੋਈ ਕਲਾਸ :meth:`~object.__init__` ਵਿਧੀ ਪਰਿਭਾਸ਼ਿਤ ਕਰਦੀ ਹੈ, ਤਾਂ ਕਲਾਸ "
"ਇੰਸਟੈਂਸ਼ੀਏਸ਼ਨ ਨਵੇਂ ਬਣੇ ਕਲਾਸ ਇੰਸਟੈਂਸ ਲਈ ਆਪਣੇ ਆਪ :meth:`!__init__` ਨੂੰ "
"ਚਲਾਉਂਦੀ ਹੈ। ਇਸ ਉਦਾਹਰਨ ਵਿੱਚ ਇੱਕ ਨਵਾਂ ਅਤੇ ਸ਼ੁਰੂਆਤੀਕ੍ਰਿਤ ਇੰਸਟੈਂਸ ਇਸ ਤਰ੍ਹਾਂ "
"ਪ੍ਰਾਪਤ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ::"
#: ../../tutorial/classes.rst:305
msgid ""
"Of course, the :meth:`~object.__init__` method may have arguments for "
"greater flexibility. In that case, arguments given to the class "
"instantiation operator are passed on to :meth:`!__init__`. For example, ::"
msgstr ""
"ਬੇਸ਼ੱਕ, ਵੱਧ ਲਚਕਤਾ ਲਈ :meth:`~object.__init__` ਵਿਧੀ ਵਿੱਚ ਆਰਗੂਮੈਂਟ ਹੋ ਸਕਦੇ "
"ਹਨ। ਇਸ ਸਥਿਤੀ ਵਿੱਚ ਕਲਾਸ ਇੰਸਟੈਂਸ਼ੀਏਸ਼ਨ ਓਪਰੇਟਰ ਨੂੰ ਦਿੱਤੇ ਗਏ ਆਰਗੂਮੈਂਟ "
":meth:`!__init__` ਨੂੰ ਭੇਜੇ ਜਾਂਦੇ ਹਨ। ਉਦਾਹਰਨ ਲਈ::"
#: ../../tutorial/classes.rst:309
msgid ""
">>> class Complex:\n"
"... def __init__(self, realpart, imagpart):\n"
"... self.r = realpart\n"
"... self.i = imagpart\n"
"...\n"
">>> x = Complex(3.0, -4.5)\n"
">>> x.r, x.i\n"
"(3.0, -4.5)"
msgstr ""
">>> class Complex:\n"
"... def __init__(self, realpart, imagpart):\n"
"... self.r = realpart\n"
"... self.i = imagpart\n"
"...\n"
">>> x = Complex(3.0, -4.5)\n"
">>> x.r, x.i\n"
"(3.0, -4.5)"
#: ../../tutorial/classes.rst:322
msgid "Instance Objects"
msgstr "ਇੰਸਟੈਂਸ ਆਬਜੈਕਟ"
#: ../../tutorial/classes.rst:324
msgid ""
"Now what can we do with instance objects? The only operations understood by "
"instance objects are attribute references. There are two kinds of valid "
"attribute names: data attributes and methods."
msgstr ""
"ਹੁਣ ਅਸੀਂ ਇੰਸਟੈਂਸ ਆਬਜੈਕਟਾਂ ਨਾਲ ਕੀ ਕਰ ਸਕਦੇ ਹਾਂ? ਇੰਸਟੈਂਸ ਵਸਤੂਆਂ ਦੁਆਰਾ ਸਮਝੀ "
"ਜਾਣ ਵਾਲੀ ਇਕੱਲੀ ਕਾਰਵਾਈ ਐਟ੍ਰਿਬਿਊਟ ਹਵਾਲਾ ਹੈ। ਵੈਧ ਐਟ੍ਰਿਬਿਊਟ ਨਾਂਵਾਂ ਦੀਆਂ ਦੋ "
"ਕਿਸਮਾਂ ਹਨ: ਡਾਟਾ ਐਟ੍ਰਿਬਿਊਟ ਅਤੇ ਵਿਧੀਆਂ।"
#: ../../tutorial/classes.rst:328
msgid ""
"*Data attributes* correspond to \"instance variables\" in Smalltalk, and to "
"\"data members\" in C++. Data attributes need not be declared; like local "
"variables, they spring into existence when they are first assigned to. For "
"example, if ``x`` is the instance of :class:`!MyClass` created above, the "
"following piece of code will print the value ``16``, without leaving a "
"trace::"
msgstr ""
"*ਡਾਟਾ ਐਟ੍ਰਿਬਿਊਟ* Smalltalk ਵਿੱਚ \"instance variables\" ਅਤੇ C++ ਵਿੱਚ "
"\"data members\" ਦੇ ਸਮਾਨ ਹੁੰਦੇ ਹਨ। ਡਾਟਾ ਐਟ੍ਰਿਬਿਊਟਾਂ ਨੂੰ ਪਹਿਲਾਂ ਤੋਂ ਘੋਸ਼ਿਤ "
"ਕਰਨ ਦੀ ਲੋੜ ਨਹੀਂ ਹੁੰਦੀ; ਸਥਾਨਕ ਵੇਰੀਏਬਲਾਂ ਵਾਂਗ ਇਹ ਪਹਿਲੀ ਵਾਰ ਅਸਾਈਨ ਹੋਣ 'ਤੇ "
"ਮੌਜੂਦਗੀ ਵਿੱਚ ਆ ਜਾਂਦੇ ਹਨ। ਉਦਾਹਰਨ ਵਜੋਂ, ਜੇ ``x`` ਉੱਪਰ ਬਣਾਇਆ ਗਿਆ "
":class:`!MyClass` ਦਾ ਇੰਸਟੈਂਸ ਹੈ, ਤਾਂ ਹੇਠਾਂ ਦਿੱਤਾ ਕੋਡ ``16`` ਮੁੱਲ ਪ੍ਰਿੰਟ "
"ਕਰੇਗਾ ਅਤੇ ਬਾਅਦ ਵਿੱਚ ਕੋਈ ਨਿਸ਼ਾਨ ਨਹੀਂ ਛੱਡੇਗਾ::"
#: ../../tutorial/classes.rst:334
msgid ""
"x.counter = 1\n"
"while x.counter < 10:\n"
" x.counter = x.counter * 2\n"
"print(x.counter)\n"
"del x.counter"
msgstr ""
"x.counter = 1\n"
"while x.counter < 10:\n"
" x.counter = x.counter * 2\n"
"print(x.counter)\n"
"del x.counter"
#: ../../tutorial/classes.rst:340
msgid ""
"The other kind of instance attribute reference is a *method*. A method is a "
"function that \"belongs to\" an object."
msgstr ""
"ਇੰਸਟੈਂਸ ਐਟ੍ਰਿਬਿਊਟ ਹਵਾਲੇ ਦੀ ਦੂਜੀ ਕਿਸਮ *ਵਿਧੀ (method)* ਹੈ। ਵਿਧੀ ਇੱਕ ਐਸਾ "
"ਫੰਕਸ਼ਨ ਹੈ ਜੋ ਕਿਸੇ ਆਬਜੈਕਟ ਨਾਲ ਸੰਬੰਧਿਤ ਹੁੰਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:345
msgid ""
"Valid method names of an instance object depend on its class. By "
"definition, all attributes of a class that are function objects define "
"corresponding methods of its instances. So in our example, ``x.f`` is a "
"valid method reference, since ``MyClass.f`` is a function, but ``x.i`` is "
"not, since ``MyClass.i`` is not. But ``x.f`` is not the same thing as "
"``MyClass.f`` --- it is a *method object*, not a function object."
msgstr ""
"ਕਿਸੇ ਇੰਸਟੈਂਸ ਆਬਜੈਕਟ ਦੇ ਵੈਧ ਮੈਥਡ ਨਾਮ ਉਸਦੀ ਕਲਾਸ 'ਤੇ ਨਿਰਭਰ ਕਰਦੇ ਹਨ। "
"ਪਰਿਭਾਸ਼ਾ ਅਨੁਸਾਰ, ਕਲਾਸ ਦੇ ਉਹ ਸਾਰੇ ਐਟ੍ਰਿਬਿਊਟ ਜੋ ਫੰਕਸ਼ਨ ਆਬਜੈਕਟ ਹੁੰਦੇ ਹਨ, "
"ਉਸਦੇ ਇੰਸਟੈਂਸਾਂ ਲਈ ਸੰਬੰਧਿਤ ਮੈਥਡ ਪਰਿਭਾਸ਼ਿਤ ਕਰਦੇ ਹਨ। ਇਸ ਲਈ ਸਾਡੀ ਉਦਾਹਰਨ ਵਿੱਚ "
"``x.f`` ਇੱਕ ਵੈਧ ਮੈਥਡ ਹਵਾਲਾ ਹੈ ਕਿਉਂਕਿ ``MyClass.f`` ਇੱਕ ਫੰਕਸ਼ਨ ਹੈ, ਪਰ "
"``x.i`` ਨਹੀਂ ਕਿਉਂਕਿ ``MyClass.i`` ਫੰਕਸ਼ਨ ਨਹੀਂ ਹੈ। ਹਾਲਾਂਕਿ ``x.f`` ਅਤੇ "
"``MyClass.f`` ਇੱਕੋ ਚੀਜ਼ ਨਹੀਂ ਹਨ — ``x.f`` ਇੱਕ *ਮੈਥਡ ਆਬਜੈਕਟ* ਹੈ, "
"ਫੰਕਸ਼ਨ ਆਬਜੈਕਟ ਨਹੀਂ।"
#: ../../tutorial/classes.rst:356
msgid "Method Objects"
msgstr "ਵਿਧੀ ਵਸਤੂਆਂ"
#: ../../tutorial/classes.rst:358
msgid "Usually, a method is called right after it is bound::"
msgstr ""
"ਆਮ ਤੌਰ 'ਤੇ, ਕਿਸੇ ਮੈਥਡ ਨੂੰ ਉਸਦੇ ਬਾਈਂਡ ਹੋਣ ਦੇ ਤੁਰੰਤ ਬਾਅਦ ਕਾਲ ਕੀਤਾ ਜਾਂਦਾ ਹੈ::"
#: ../../tutorial/classes.rst:360
msgid "x.f()"
msgstr "x.f()"
#: ../../tutorial/classes.rst:362
msgid ""
"If ``x = MyClass()``, as above, this will return the string ``'hello "
"world'``. However, it is not necessary to call a method right away: ``x.f`` "
"is a method object, and can be stored away and called at a later time. For "
"example::"
msgstr ""
"ਜੇ ਉੱਪਰ ਵਾਂਗ ``x = MyClass()`` ਹੋਵੇ, ਤਾਂ ਇਹ ``'hello world'`` ਸਟ੍ਰਿੰਗ "
"ਵਾਪਸ ਕਰੇਗਾ। ਪਰ ਮੈਥਡ ਨੂੰ ਤੁਰੰਤ ਕਾਲ ਕਰਨਾ ਲਾਜ਼ਮੀ ਨਹੀਂ ਹੈ। ``x.f`` ਇੱਕ ਮੈਥਡ "
"ਆਬਜੈਕਟ ਹੈ ਅਤੇ ਇਸਨੂੰ ਸੰਭਾਲ ਕੇ ਬਾਅਦ ਵਿੱਚ ਵੀ ਕਾਲ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ। ਉਦਾਹਰਨ ਲਈ::"
#: ../../tutorial/classes.rst:366
msgid ""
"xf = x.f\n"
"while True:\n"
" print(xf())"
msgstr ""
"xf = x.f\n"
"while True:\n"
" print(xf())"
#: ../../tutorial/classes.rst:370
msgid "will continue to print ``hello world`` until the end of time."
msgstr ""
"ਇਹ ਅਨੰਤ ਸਮੇਂ ਤੱਕ ``hello world`` ਪ੍ਰਿੰਟ ਕਰਦਾ ਰਹੇਗਾ।"
#: ../../tutorial/classes.rst:372
msgid ""
"What exactly happens when a method is called? You may have noticed that ``x."
"f()`` was called without an argument above, even though the function "
"definition for :meth:`!f` specified an argument. What happened to the "
"argument? Surely Python raises an exception when a function that requires an "
"argument is called without any --- even if the argument isn't actually "
"used..."
msgstr ""
"ਜਦੋਂ ਕੋਈ ਮੈਥਡ ਕਾਲ ਕੀਤਾ ਜਾਂਦਾ ਹੈ ਤਾਂ ਅਸਲ ਵਿੱਚ ਕੀ ਹੁੰਦਾ ਹੈ? ਤੁਸੀਂ ਧਿਆਨ ਦਿੱਤਾ "
"ਹੋਵੇਗਾ ਕਿ ਉੱਪਰ ``x.f()`` ਬਿਨਾਂ ਕਿਸੇ ਆਰਗੂਮੈਂਟ ਦੇ ਕਾਲ ਕੀਤਾ ਗਿਆ ਸੀ, ਹਾਲਾਂਕਿ "
":meth:`!f` ਦੀ ਪਰਿਭਾਸ਼ਾ ਵਿੱਚ ਇੱਕ ਆਰਗੂਮੈਂਟ ਦਿੱਤਾ ਗਿਆ ਸੀ। ਫਿਰ ਉਹ ਆਰਗੂਮੈਂਟ "
"ਕਿੱਥੇ ਗਿਆ? ਆਮ ਤੌਰ 'ਤੇ Python ਉਸ ਵੇਲੇ ਐਕਸੈਪਸ਼ਨ ਪੈਦਾ ਕਰਦਾ ਹੈ ਜਦੋਂ ਕਿਸੇ "
"ਲੋੜੀਂਦੇ ਆਰਗੂਮੈਂਟ ਵਾਲੇ ਫੰਕਸ਼ਨ ਨੂੰ ਬਿਨਾਂ ਆਰਗੂਮੈਂਟ ਦੇ ਕਾਲ ਕੀਤਾ ਜਾਵੇ — ਭਾਵੇਂ "
"ਉਹ ਆਰਗੂਮੈਂਟ ਵਰਤਿਆ ਨਾ ਵੀ ਜਾਵੇ..."
#: ../../tutorial/classes.rst:378
msgid ""
"Actually, you may have guessed the answer: the special thing about methods "
"is that the instance object is passed as the first argument of the "
"function. In our example, the call ``x.f()`` is exactly equivalent to "
"``MyClass.f(x)``. In general, calling a method with a list of *n* arguments "
"is equivalent to calling the corresponding function with an argument list "
"that is created by inserting the method's instance object before the first "
"argument."
msgstr ""
"ਅਸਲ ਵਿੱਚ, ਤੁਸੀਂ ਸ਼ਾਇਦ ਇਸਦਾ ਜਵਾਬ ਅੰਦਾਜ਼ਾ ਲਾ ਲਿਆ ਹੋਵੇਗਾ। ਮੈਥਡਾਂ ਦੀ ਖਾਸ ਗੱਲ "
"ਇਹ ਹੈ ਕਿ ਇੰਸਟੈਂਸ ਆਬਜੈਕਟ ਆਪਣੇ ਆਪ ਫੰਕਸ਼ਨ ਦੇ ਪਹਿਲੇ ਆਰਗੂਮੈਂਟ ਵਜੋਂ ਭੇਜਿਆ ਜਾਂਦਾ "
"ਹੈ। ਸਾਡੀ ਉਦਾਹਰਨ ਵਿੱਚ ``x.f()`` ਦੀ ਕਾਲ ਬਿਲਕੁਲ ``MyClass.f(x)`` ਦੇ ਬਰਾਬਰ "
"ਹੈ। ਆਮ ਤੌਰ 'ਤੇ, *n* ਆਰਗੂਮੈਂਟਾਂ ਵਾਲੇ ਮੈਥਡ ਨੂੰ ਕਾਲ ਕਰਨਾ ਉਸ ਸੰਬੰਧਿਤ ਫੰਕਸ਼ਨ "
"ਨੂੰ ਕਾਲ ਕਰਨ ਦੇ ਬਰਾਬਰ ਹੈ ਜਿਸਦੇ ਆਰਗੂਮੈਂਟਾਂ ਦੀ ਸੂਚੀ ਦੇ ਸ਼ੁਰੂ ਵਿੱਚ ਇੰਸਟੈਂਸ "
"ਆਬਜੈਕਟ ਜੋੜਿਆ ਗਿਆ ਹੋਵੇ।"
#: ../../tutorial/classes.rst:385
msgid ""
"In general, methods work as follows. When a non-data attribute of an "
"instance is referenced, the instance's class is searched. If the name "
"denotes a valid class attribute that is a function object, references to "
"both the instance object and the function object are packed into a method "
"object. When the method object is called with an argument list, a new "
"argument list is constructed from the instance object and the argument list, "
"and the function object is called with this new argument list."
msgstr ""
"ਆਮ ਤੌਰ 'ਤੇ ਮੈਥਡ ਇਸ ਤਰ੍ਹਾਂ ਕੰਮ ਕਰਦੇ ਹਨ। ਜਦੋਂ ਕਿਸੇ ਇੰਸਟੈਂਸ ਦੇ ਗੈਰ-ਡਾਟਾ "
"ਐਟ੍ਰਿਬਿਊਟ ਦਾ ਹਵਾਲਾ ਦਿੱਤਾ ਜਾਂਦਾ ਹੈ, ਤਾਂ ਉਸਦੀ ਕਲਾਸ ਵਿੱਚ ਖੋਜ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। "
"ਜੇਕਰ ਉਹ ਨਾਮ ਕਿਸੇ ਐਸੇ ਕਲਾਸ ਐਟ੍ਰਿਬਿਊਟ ਨੂੰ ਦਰਸਾਉਂਦਾ ਹੋਵੇ ਜੋ ਇੱਕ ਫੰਕਸ਼ਨ ਆਬਜੈਕਟ "
"ਹੈ, ਤਾਂ ਇੰਸਟੈਂਸ ਆਬਜੈਕਟ ਅਤੇ ਫੰਕਸ਼ਨ ਆਬਜੈਕਟ ਦੋਵਾਂ ਦੇ ਹਵਾਲੇ ਮਿਲਾ ਕੇ ਇੱਕ ਮੈਥਡ "
"ਆਬਜੈਕਟ ਬਣਾਇਆ ਜਾਂਦਾ ਹੈ। ਜਦੋਂ ਇਸ ਮੈਥਡ ਆਬਜੈਕਟ ਨੂੰ ਆਰਗੂਮੈਂਟਾਂ ਨਾਲ ਕਾਲ ਕੀਤਾ "
"ਜਾਂਦਾ ਹੈ, ਤਾਂ ਇੰਸਟੈਂਸ ਆਬਜੈਕਟ ਅਤੇ ਦਿੱਤੇ ਗਏ ਆਰਗੂਮੈਂਟਾਂ ਤੋਂ ਇੱਕ ਨਵੀਂ "
"ਆਰਗੂਮੈਂਟ ਸੂਚੀ ਬਣਾਈ ਜਾਂਦੀ ਹੈ ਅਤੇ ਫੰਕਸ਼ਨ ਆਬਜੈਕਟ ਨੂੰ ਇਸ ਨਵੀਂ ਸੂਚੀ ਨਾਲ ਕਾਲ "
"ਕੀਤਾ ਜਾਂਦਾ ਹੈ।"
#: ../../tutorial/classes.rst:398
msgid "Class and Instance Variables"
msgstr "ਕਲਾਸ ਅਤੇ ਇੰਸਟੈਂਸ ਵੇਰੀਏਬਲ"
#: ../../tutorial/classes.rst:400
msgid ""
"Generally speaking, instance variables are for data unique to each instance "
"and class variables are for attributes and methods shared by all instances "
"of the class::"
msgstr ""
"ਆਮ ਤੌਰ 'ਤੇ, ਇੰਸਟੈਂਸ ਵੇਰੀਏਬਲ ਹਰ ਇੰਸਟੈਂਸ ਲਈ ਵਿਲੱਖਣ ਡਾਟਾ ਸੰਭਾਲਣ ਲਈ ਹੁੰਦੇ "
"ਹਨ ਅਤੇ ਕਲਾਸ ਵੇਰੀਏਬਲ ਉਹਨਾਂ ਐਟ੍ਰਿਬਿਊਟਾਂ ਅਤੇ ਵਿਧੀਆਂ ਲਈ ਹੁੰਦੇ ਹਨ ਜੋ ਕਲਾਸ ਦੇ "
"ਸਾਰੇ ਇੰਸਟੈਂਸਾਂ ਦੁਆਰਾ ਸਾਂਝੇ ਕੀਤੇ ਜਾਂਦੇ ਹਨ::"
#: ../../tutorial/classes.rst:404
msgid ""
"class Dog:\n"
"\n"
" kind = 'canine' # class variable shared by all instances\n"
"\n"
" def __init__(self, name):\n"
" self.name = name # instance variable unique to each instance\n"
"\n"
">>> d = Dog('Fido')\n"
">>> e = Dog('Buddy')\n"
">>> d.kind # shared by all dogs\n"
"'canine'\n"
">>> e.kind # shared by all dogs\n"
"'canine'\n"
">>> d.name # unique to d\n"
"'Fido'\n"
">>> e.name # unique to e\n"
"'Buddy'"
msgstr ""
"class Dog:\n"
"\n"
" kind = 'canine' # class variable shared by all instances\n"
"\n"
" def __init__(self, name):\n"
" self.name = name # instance variable unique to each instance\n"
"\n"
">>> d = Dog('Fido')\n"
">>> e = Dog('Buddy')\n"
">>> d.kind # shared by all dogs\n"
"'canine'\n"
">>> e.kind # shared by all dogs\n"
"'canine'\n"
">>> d.name # unique to d\n"
"'Fido'\n"
">>> e.name # unique to e\n"
"'Buddy'"
#: ../../tutorial/classes.rst:422
msgid ""
"As discussed in :ref:`tut-object`, shared data can have possibly surprising "
"effects involving :term:`mutable` objects such as lists and dictionaries. "
"For example, the *tricks* list in the following code should not be used as a "
"class variable because just a single list would be shared by all *Dog* "
"instances::"
msgstr ""
"ਜਿਵੇਂ ਕਿ :ref:`tut-object` ਵਿੱਚ ਚਰਚਾ ਕੀਤੀ ਗਈ ਹੈ, ਸਾਂਝਾ ਡਾਟਾ "
":term:`mutable` ਆਬਜੈਕਟਾਂ ਜਿਵੇਂ ਲਿਸਟਾਂ ਅਤੇ ਡਿਕਸ਼ਨਰੀਆਂ ਨਾਲ ਕਈ ਵਾਰ ਹੈਰਾਨੀਜਨਕ "
"ਨਤੀਜੇ ਪੈਦਾ ਕਰ ਸਕਦਾ ਹੈ। ਉਦਾਹਰਨ ਵਜੋਂ, ਹੇਠਾਂ ਦਿੱਤੇ ਕੋਡ ਵਿੱਚ *tricks* ਲਿਸਟ ਨੂੰ "
"ਕਲਾਸ ਵੇਰੀਏਬਲ ਵਜੋਂ ਨਹੀਂ ਵਰਤਣਾ ਚਾਹੀਦਾ ਕਿਉਂਕਿ ਇੱਕੋ ਲਿਸਟ ਸਾਰੇ *Dog* ਇੰਸਟੈਂਸਾਂ "
"ਵੱਲੋਂ ਸਾਂਝੀ ਕੀਤੀ ਜਾਵੇਗੀ::"
#: ../../tutorial/classes.rst:428
msgid ""
"class Dog:\n"
"\n"
" tricks = [] # mistaken use of a class variable\n"
"\n"
" def __init__(self, name):\n"
" self.name = name\n"
"\n"
" def add_trick(self, trick):\n"
" self.tricks.append(trick)\n"
"\n"
">>> d = Dog('Fido')\n"
">>> e = Dog('Buddy')\n"
">>> d.add_trick('roll over')\n"
">>> e.add_trick('play dead')\n"
">>> d.tricks # unexpectedly shared by all dogs\n"
"['roll over', 'play dead']"
msgstr ""
"class Dog:\n"
"\n"
" tricks = [] # mistaken use of a class variable\n"
"\n"
" def __init__(self, name):\n"
" self.name = name\n"
"\n"
" def add_trick(self, trick):\n"
" self.tricks.append(trick)\n"
"\n"
">>> d = Dog('Fido')\n"
">>> e = Dog('Buddy')\n"
">>> d.add_trick('roll over')\n"
">>> e.add_trick('play dead')\n"
">>> d.tricks # unexpectedly shared by all dogs\n"
"['roll over', 'play dead']"
#: ../../tutorial/classes.rst:445
msgid "Correct design of the class should use an instance variable instead::"
msgstr "ਕਲਾਸ ਦੇ ਸਹੀ ਡਿਜ਼ਾਇਨ ਵਿੱਚ ਇਸਦੀ ਬਜਾਏ ਇੱਕ ਇੰਸਟੈਂਸ ਵੇਰੀਏਬਲ ਵਰਤਣਾ ਚਾਹੀਦਾ ਹੈ::"
#: ../../tutorial/classes.rst:447
msgid ""
"class Dog:\n"
"\n"
" def __init__(self, name):\n"
" self.name = name\n"
" self.tricks = [] # creates a new empty list for each dog\n"
"\n"
" def add_trick(self, trick):\n"
" self.tricks.append(trick)\n"
"\n"
">>> d = Dog('Fido')\n"
">>> e = Dog('Buddy')\n"
">>> d.add_trick('roll over')\n"
">>> e.add_trick('play dead')\n"
">>> d.tricks\n"
"['roll over']\n"
">>> e.tricks\n"
"['play dead']"
msgstr ""
"class Dog:\n"
"\n"
" def __init__(self, name):\n"
" self.name = name\n"
" self.tricks = [] # creates a new empty list for each dog\n"
"\n"
" def add_trick(self, trick):\n"
" self.tricks.append(trick)\n"
"\n"
">>> d = Dog('Fido')\n"
">>> e = Dog('Buddy')\n"
">>> d.add_trick('roll over')\n"
">>> e.add_trick('play dead')\n"
">>> d.tricks\n"
"['roll over']\n"
">>> e.tricks\n"
"['play dead']"
#: ../../tutorial/classes.rst:469
msgid "Random Remarks"
msgstr "ਕੁਝ ਵਾਧੂ ਟਿੱਪਣੀਆਂ"
#: ../../tutorial/classes.rst:473
msgid ""
"If the same attribute name occurs in both an instance and in a class, then "
"attribute lookup prioritizes the instance::"
msgstr ""
"ਜੇਕਰ ਇੱਕੋ ਐਟ੍ਰਿਬਿਊਟ ਨਾਂ ਇੰਸਟੈਂਸ ਅਤੇ ਕਲਾਸ ਦੋਵਾਂ ਵਿੱਚ ਮੌਜੂਦ ਹੋਵੇ, ਤਾਂ "