This file is indexed.

/usr/share/doc/python3.4/html/glossary.html is in python3.4-doc 3.4.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Glossary &mdash; Python 3.4.2 documentation</title>
    
    <link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '3.4.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 3.4.2 documentation"
          href="_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="about.html" />
    <link rel="copyright" title="Copyright" href="copyright.html" />
    <link rel="top" title="Python 3.4.2 documentation" href="index.html" />
    <link rel="next" title="About these documents" href="about.html" />
    <link rel="prev" title="“Why is Python Installed on my Computer?” FAQ" href="faq/installed.html" />
    <link rel="shortcut icon" type="image/png" href="_static/py.png" />
    <script type="text/javascript" src="_static/copybutton.js"></script>
    
    
 

  </head>
  <body>  
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="about.html" title="About these documents"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="faq/installed.html" title="“Why is Python Installed on my Computer?” FAQ"
             accesskey="P">previous</a> |</li>
        <li><img src="_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="index.html">3.4.2 Documentation</a> &raquo;
        </li>
 
      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="glossary">
<span id="id1"></span><h1>Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline"></a></h1>
<dl class="glossary docutils">
<dt id="term-"><tt class="docutils literal"><span class="pre">&gt;&gt;&gt;</span></tt></dt>
<dd>The default Python prompt of the interactive shell.  Often seen for code
examples which can be executed interactively in the interpreter.</dd>
<dt id="term-1"><tt class="docutils literal"><span class="pre">...</span></tt></dt>
<dd>The default Python prompt of the interactive shell when entering code for
an indented code block or within a pair of matching left and right
delimiters (parentheses, square brackets or curly braces).</dd>
<dt id="term-to3">2to3</dt>
<dd><p class="first">A tool that tries to convert Python 2.x code to Python 3.x code by
handling most of the incompatibilities which can be detected by parsing the
source and traversing the parse tree.</p>
<p class="last">2to3 is available in the standard library as <a class="reference internal" href="library/2to3.html#module-lib2to3" title="lib2to3: the 2to3 library"><tt class="xref py py-mod docutils literal"><span class="pre">lib2to3</span></tt></a>; a standalone
entry point is provided as <tt class="file docutils literal"><span class="pre">Tools/scripts/2to3</span></tt>.  See
<a class="reference internal" href="library/2to3.html#to3-reference"><em>2to3 - Automated Python 2 to 3 code translation</em></a>.</p>
</dd>
<dt id="term-abstract-base-class">abstract base class</dt>
<dd>Abstract base classes complement <a class="reference internal" href="#term-duck-typing"><em class="xref std std-term">duck-typing</em></a> by
providing a way to define interfaces when other techniques like
<a class="reference internal" href="library/functions.html#hasattr" title="hasattr"><tt class="xref py py-func docutils literal"><span class="pre">hasattr()</span></tt></a> would be clumsy or subtly wrong (for example with
<a class="reference internal" href="reference/datamodel.html#special-lookup"><em>magic methods</em></a>).  ABCs introduce virtual
subclasses, which are classes that don&#8217;t inherit from a class but are
still recognized by <a class="reference internal" href="library/functions.html#isinstance" title="isinstance"><tt class="xref py py-func docutils literal"><span class="pre">isinstance()</span></tt></a> and <a class="reference internal" href="library/functions.html#issubclass" title="issubclass"><tt class="xref py py-func docutils literal"><span class="pre">issubclass()</span></tt></a>; see the
<a class="reference internal" href="library/abc.html#module-abc" title="abc: Abstract base classes according to PEP 3119."><tt class="xref py py-mod docutils literal"><span class="pre">abc</span></tt></a> module documentation.  Python comes with many built-in ABCs for
data structures (in the <a class="reference internal" href="library/collections.abc.html#module-collections.abc" title="collections.abc: Abstract base classes for containers"><tt class="xref py py-mod docutils literal"><span class="pre">collections.abc</span></tt></a> module), numbers (in the
<a class="reference internal" href="library/numbers.html#module-numbers" title="numbers: Numeric abstract base classes (Complex, Real, Integral, etc.)."><tt class="xref py py-mod docutils literal"><span class="pre">numbers</span></tt></a> module), streams (in the <a class="reference internal" href="library/io.html#module-io" title="io: Core tools for working with streams."><tt class="xref py py-mod docutils literal"><span class="pre">io</span></tt></a> module), import finders
and loaders (in the <a class="reference internal" href="library/importlib.html#module-importlib.abc" title="importlib.abc: Abstract base classes related to import"><tt class="xref py py-mod docutils literal"><span class="pre">importlib.abc</span></tt></a> module).  You can create your own
ABCs with the <a class="reference internal" href="library/abc.html#module-abc" title="abc: Abstract base classes according to PEP 3119."><tt class="xref py py-mod docutils literal"><span class="pre">abc</span></tt></a> module.</dd>
<dt id="term-argument">argument</dt>
<dd><p class="first">A value passed to a <a class="reference internal" href="#term-function"><em class="xref std std-term">function</em></a> (or <a class="reference internal" href="#term-method"><em class="xref std std-term">method</em></a>) when calling the
function.  There are two kinds of argument:</p>
<ul>
<li><p class="first"><em class="dfn">keyword argument</em>: an argument preceded by an identifier (e.g.
<tt class="docutils literal"><span class="pre">name=</span></tt>) in a function call or passed as a value in a dictionary
preceded by <tt class="docutils literal"><span class="pre">**</span></tt>.  For example, <tt class="docutils literal"><span class="pre">3</span></tt> and <tt class="docutils literal"><span class="pre">5</span></tt> are both keyword
arguments in the following calls to <a class="reference internal" href="library/functions.html#complex" title="complex"><tt class="xref py py-func docutils literal"><span class="pre">complex()</span></tt></a>:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="nb">complex</span><span class="p">(</span><span class="n">real</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">imag</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="nb">complex</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s">&#39;real&#39;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> <span class="s">&#39;imag&#39;</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span>
</pre></div>
</div>
</li>
<li><p class="first"><em class="dfn">positional argument</em>: an argument that is not a keyword argument.
Positional arguments can appear at the beginning of an argument list
and/or be passed as elements of an <a class="reference internal" href="#term-iterable"><em class="xref std std-term">iterable</em></a> preceded by <tt class="docutils literal"><span class="pre">*</span></tt>.
For example, <tt class="docutils literal"><span class="pre">3</span></tt> and <tt class="docutils literal"><span class="pre">5</span></tt> are both positional arguments in the
following calls:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="nb">complex</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="nb">complex</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
</pre></div>
</div>
</li>
</ul>
<p>Arguments are assigned to the named local variables in a function body.
See the <a class="reference internal" href="reference/expressions.html#calls"><em>Calls</em></a> section for the rules governing this assignment.
Syntactically, any expression can be used to represent an argument; the
evaluated value is assigned to the local variable.</p>
<p class="last">See also the <a class="reference internal" href="#term-parameter"><em class="xref std std-term">parameter</em></a> glossary entry, the FAQ question on
<a class="reference internal" href="faq/programming.html#faq-argument-vs-parameter"><em>the difference between arguments and parameters</em></a>, and <span class="target" id="index-0"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0362"><strong>PEP 362</strong></a>.</p>
</dd>
<dt id="term-attribute">attribute</dt>
<dd>A value associated with an object which is referenced by name using
dotted expressions.  For example, if an object <em>o</em> has an attribute
<em>a</em> it would be referenced as <em>o.a</em>.</dd>
<dt id="term-bdfl">BDFL</dt>
<dd>Benevolent Dictator For Life, a.k.a. <a class="reference external" href="http://www.python.org/~guido/">Guido van Rossum</a>, Python&#8217;s creator.</dd>
<dt id="term-binary-file">binary file</dt>
<dd><p class="first">A <a class="reference internal" href="#term-file-object"><em class="xref std std-term">file object</em></a> able to read and write
<a class="reference internal" href="#term-bytes-like-object"><em class="xref std std-term">bytes-like objects</em></a>.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">A <a class="reference internal" href="#term-text-file"><em class="xref std std-term">text file</em></a> reads and writes <a class="reference internal" href="library/stdtypes.html#str" title="str"><tt class="xref py py-class docutils literal"><span class="pre">str</span></tt></a> objects.</p>
</div>
</dd>
<dt id="term-bytes-like-object">bytes-like object</dt>
<dd>An object that supports the <a class="reference internal" href="c-api/buffer.html#bufferobjects"><em>Buffer Protocol</em></a>, like <a class="reference internal" href="library/functions.html#bytes" title="bytes"><tt class="xref py py-class docutils literal"><span class="pre">bytes</span></tt></a>,
<a class="reference internal" href="library/functions.html#bytearray" title="bytearray"><tt class="xref py py-class docutils literal"><span class="pre">bytearray</span></tt></a> or <a class="reference internal" href="library/stdtypes.html#memoryview" title="memoryview"><tt class="xref py py-class docutils literal"><span class="pre">memoryview</span></tt></a>.  Bytes-like objects can
be used for various operations that expect binary data, such as
compression, saving to a binary file or sending over a socket.
Some operations need the binary data to be mutable, in which case
not all bytes-like objects can apply.</dd>
<dt id="term-bytecode">bytecode</dt>
<dd><p class="first">Python source code is compiled into bytecode, the internal representation
of a Python program in the CPython interpreter.  The bytecode is also
cached in <tt class="docutils literal"><span class="pre">.pyc</span></tt> and <tt class="docutils literal"><span class="pre">.pyo</span></tt> files so that executing the same file is
faster the second time (recompilation from source to bytecode can be
avoided).  This &#8220;intermediate language&#8221; is said to run on a
<a class="reference internal" href="#term-virtual-machine"><em class="xref std std-term">virtual machine</em></a> that executes the machine code corresponding to
each bytecode. Do note that bytecodes are not expected to work between
different Python virtual machines, nor to be stable between Python
releases.</p>
<p class="last">A list of bytecode instructions can be found in the documentation for
<a class="reference internal" href="library/dis.html#bytecodes"><em>the dis module</em></a>.</p>
</dd>
<dt id="term-class">class</dt>
<dd>A template for creating user-defined objects. Class definitions
normally contain method definitions which operate on instances of the
class.</dd>
<dt id="term-coercion">coercion</dt>
<dd>The implicit conversion of an instance of one type to another during an
operation which involves two arguments of the same type.  For example,
<tt class="docutils literal"><span class="pre">int(3.15)</span></tt> converts the floating point number to the integer <tt class="docutils literal"><span class="pre">3</span></tt>, but
in <tt class="docutils literal"><span class="pre">3+4.5</span></tt>, each argument is of a different type (one int, one float),
and both must be converted to the same type before they can be added or it
will raise a <tt class="docutils literal"><span class="pre">TypeError</span></tt>.  Without coercion, all arguments of even
compatible types would have to be normalized to the same value by the
programmer, e.g., <tt class="docutils literal"><span class="pre">float(3)+4.5</span></tt> rather than just <tt class="docutils literal"><span class="pre">3+4.5</span></tt>.</dd>
<dt id="term-complex-number">complex number</dt>
<dd>An extension of the familiar real number system in which all numbers are
expressed as a sum of a real part and an imaginary part.  Imaginary
numbers are real multiples of the imaginary unit (the square root of
<tt class="docutils literal"><span class="pre">-1</span></tt>), often written <tt class="docutils literal"><span class="pre">i</span></tt> in mathematics or <tt class="docutils literal"><span class="pre">j</span></tt> in
engineering.  Python has built-in support for complex numbers, which are
written with this latter notation; the imaginary part is written with a
<tt class="docutils literal"><span class="pre">j</span></tt> suffix, e.g., <tt class="docutils literal"><span class="pre">3+1j</span></tt>.  To get access to complex equivalents of the
<a class="reference internal" href="library/math.html#module-math" title="math: Mathematical functions (sin() etc.)."><tt class="xref py py-mod docutils literal"><span class="pre">math</span></tt></a> module, use <a class="reference internal" href="library/cmath.html#module-cmath" title="cmath: Mathematical functions for complex numbers."><tt class="xref py py-mod docutils literal"><span class="pre">cmath</span></tt></a>.  Use of complex numbers is a fairly
advanced mathematical feature.  If you&#8217;re not aware of a need for them,
it&#8217;s almost certain you can safely ignore them.</dd>
<dt id="term-context-manager">context manager</dt>
<dd>An object which controls the environment seen in a <a class="reference internal" href="reference/compound_stmts.html#with"><tt class="xref std std-keyword docutils literal"><span class="pre">with</span></tt></a>
statement by defining <a class="reference internal" href="reference/datamodel.html#object.__enter__" title="object.__enter__"><tt class="xref py py-meth docutils literal"><span class="pre">__enter__()</span></tt></a> and <a class="reference internal" href="reference/datamodel.html#object.__exit__" title="object.__exit__"><tt class="xref py py-meth docutils literal"><span class="pre">__exit__()</span></tt></a> methods.
See <span class="target" id="index-1"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0343"><strong>PEP 343</strong></a>.</dd>
<dt id="term-cpython">CPython</dt>
<dd>The canonical implementation of the Python programming language, as
distributed on <a class="reference external" href="http://python.org">python.org</a>.  The term &#8220;CPython&#8221;
is used when necessary to distinguish this implementation from others
such as Jython or IronPython.</dd>
<dt id="term-decorator">decorator</dt>
<dd><p class="first">A function returning another function, usually applied as a function
transformation using the <tt class="docutils literal"><span class="pre">&#64;wrapper</span></tt> syntax.  Common examples for
decorators are <a class="reference internal" href="library/functions.html#classmethod" title="classmethod"><tt class="xref py py-func docutils literal"><span class="pre">classmethod()</span></tt></a> and <a class="reference internal" href="library/functions.html#staticmethod" title="staticmethod"><tt class="xref py py-func docutils literal"><span class="pre">staticmethod()</span></tt></a>.</p>
<p>The decorator syntax is merely syntactic sugar, the following two
function definitions are semantically equivalent:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="o">...</span><span class="p">):</span>
    <span class="o">...</span>
<span class="n">f</span> <span class="o">=</span> <span class="nb">staticmethod</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>

<span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="o">...</span><span class="p">):</span>
    <span class="o">...</span>
</pre></div>
</div>
<p class="last">The same concept exists for classes, but is less commonly used there.  See
the documentation for <a class="reference internal" href="reference/compound_stmts.html#function"><em>function definitions</em></a> and
<a class="reference internal" href="reference/compound_stmts.html#class"><em>class definitions</em></a> for more about decorators.</p>
</dd>
<dt id="term-descriptor">descriptor</dt>
<dd><p class="first">Any object which defines the methods <a class="reference internal" href="reference/datamodel.html#object.__get__" title="object.__get__"><tt class="xref py py-meth docutils literal"><span class="pre">__get__()</span></tt></a>, <a class="reference internal" href="reference/datamodel.html#object.__set__" title="object.__set__"><tt class="xref py py-meth docutils literal"><span class="pre">__set__()</span></tt></a>, or
<a class="reference internal" href="reference/datamodel.html#object.__delete__" title="object.__delete__"><tt class="xref py py-meth docutils literal"><span class="pre">__delete__()</span></tt></a>.  When a class attribute is a descriptor, its special
binding behavior is triggered upon attribute lookup.  Normally, using
<em>a.b</em> to get, set or delete an attribute looks up the object named <em>b</em> in
the class dictionary for <em>a</em>, but if <em>b</em> is a descriptor, the respective
descriptor method gets called.  Understanding descriptors is a key to a
deep understanding of Python because they are the basis for many features
including functions, methods, properties, class methods, static methods,
and reference to super classes.</p>
<p class="last">For more information about descriptors&#8217; methods, see <a class="reference internal" href="reference/datamodel.html#descriptors"><em>Implementing Descriptors</em></a>.</p>
</dd>
<dt id="term-dictionary">dictionary</dt>
<dd>An associative array, where arbitrary keys are mapped to values.  The
keys can be any object with <a class="reference internal" href="reference/datamodel.html#object.__hash__" title="object.__hash__"><tt class="xref py py-meth docutils literal"><span class="pre">__hash__()</span></tt></a> and <a class="reference internal" href="reference/datamodel.html#object.__eq__" title="object.__eq__"><tt class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></tt></a> methods.
Called a hash in Perl.</dd>
<dt id="term-docstring">docstring</dt>
<dd>A string literal which appears as the first expression in a class,
function or module.  While ignored when the suite is executed, it is
recognized by the compiler and put into the <tt class="xref py py-attr docutils literal"><span class="pre">__doc__</span></tt> attribute
of the enclosing class, function or module.  Since it is available via
introspection, it is the canonical place for documentation of the
object.</dd>
<dt id="term-duck-typing">duck-typing</dt>
<dd>A programming style which does not look at an object&#8217;s type to determine
if it has the right interface; instead, the method or attribute is simply
called or used (&#8220;If it looks like a duck and quacks like a duck, it
must be a duck.&#8221;)  By emphasizing interfaces rather than specific types,
well-designed code improves its flexibility by allowing polymorphic
substitution.  Duck-typing avoids tests using <a class="reference internal" href="library/functions.html#type" title="type"><tt class="xref py py-func docutils literal"><span class="pre">type()</span></tt></a> or
<a class="reference internal" href="library/functions.html#isinstance" title="isinstance"><tt class="xref py py-func docutils literal"><span class="pre">isinstance()</span></tt></a>.  (Note, however, that duck-typing can be complemented
with <a class="reference internal" href="#term-abstract-base-class"><em class="xref std std-term">abstract base classes</em></a>.)  Instead, it
typically employs <a class="reference internal" href="library/functions.html#hasattr" title="hasattr"><tt class="xref py py-func docutils literal"><span class="pre">hasattr()</span></tt></a> tests or <a class="reference internal" href="#term-eafp"><em class="xref std std-term">EAFP</em></a> programming.</dd>
<dt id="term-eafp">EAFP</dt>
<dd>Easier to ask for forgiveness than permission.  This common Python coding
style assumes the existence of valid keys or attributes and catches
exceptions if the assumption proves false.  This clean and fast style is
characterized by the presence of many <a class="reference internal" href="reference/compound_stmts.html#try"><tt class="xref std std-keyword docutils literal"><span class="pre">try</span></tt></a> and <a class="reference internal" href="reference/compound_stmts.html#except"><tt class="xref std std-keyword docutils literal"><span class="pre">except</span></tt></a>
statements.  The technique contrasts with the <a class="reference internal" href="#term-lbyl"><em class="xref std std-term">LBYL</em></a> style
common to many other languages such as C.</dd>
<dt id="term-expression">expression</dt>
<dd>A piece of syntax which can be evaluated to some value.  In other words,
an expression is an accumulation of expression elements like literals,
names, attribute access, operators or function calls which all return a
value.  In contrast to many other languages, not all language constructs
are expressions.  There are also <a class="reference internal" href="#term-statement"><em class="xref std std-term">statement</em></a>s which cannot be used
as expressions, such as <a class="reference internal" href="reference/compound_stmts.html#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a>.  Assignments are also statements,
not expressions.</dd>
<dt id="term-extension-module">extension module</dt>
<dd>A module written in C or C++, using Python&#8217;s C API to interact with the
core and with user code.</dd>
<dt id="term-file-object">file object</dt>
<dd><p class="first">An object exposing a file-oriented API (with methods such as
<tt class="xref py py-meth docutils literal"><span class="pre">read()</span></tt> or <tt class="xref py py-meth docutils literal"><span class="pre">write()</span></tt>) to an underlying resource.  Depending
on the way it was created, a file object can mediate access to a real
on-disk file or to another type of storage or communication device
(for example standard input/output, in-memory buffers, sockets, pipes,
etc.).  File objects are also called <em class="dfn">file-like objects</em> or
<em class="dfn">streams</em>.</p>
<p class="last">There are actually three categories of file objects: raw
<a class="reference internal" href="#term-binary-file"><em class="xref std std-term">binary files</em></a>, buffered
<a class="reference internal" href="#term-binary-file"><em class="xref std std-term">binary files</em></a> and <a class="reference internal" href="#term-text-file"><em class="xref std std-term">text files</em></a>.
Their interfaces are defined in the <a class="reference internal" href="library/io.html#module-io" title="io: Core tools for working with streams."><tt class="xref py py-mod docutils literal"><span class="pre">io</span></tt></a> module.  The canonical
way to create a file object is by using the <a class="reference internal" href="library/functions.html#open" title="open"><tt class="xref py py-func docutils literal"><span class="pre">open()</span></tt></a> function.</p>
</dd>
<dt id="term-file-like-object">file-like object</dt>
<dd>A synonym for <a class="reference internal" href="#term-file-object"><em class="xref std std-term">file object</em></a>.</dd>
<dt id="term-finder">finder</dt>
<dd>An object that tries to find the <a class="reference internal" href="#term-loader"><em class="xref std std-term">loader</em></a> for a module. It must
implement either a method named <tt class="xref py py-meth docutils literal"><span class="pre">find_loader()</span></tt> or a method named
<tt class="xref py py-meth docutils literal"><span class="pre">find_module()</span></tt>. See <span class="target" id="index-2"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0302"><strong>PEP 302</strong></a> and <span class="target" id="index-3"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0420"><strong>PEP 420</strong></a> for details and
<a class="reference internal" href="library/importlib.html#importlib.abc.Finder" title="importlib.abc.Finder"><tt class="xref py py-class docutils literal"><span class="pre">importlib.abc.Finder</span></tt></a> for an <a class="reference internal" href="#term-abstract-base-class"><em class="xref std std-term">abstract base class</em></a>.</dd>
<dt id="term-floor-division">floor division</dt>
<dd>Mathematical division that rounds down to nearest integer.  The floor
division operator is <tt class="docutils literal"><span class="pre">//</span></tt>.  For example, the expression <tt class="docutils literal"><span class="pre">11</span> <span class="pre">//</span> <span class="pre">4</span></tt>
evaluates to <tt class="docutils literal"><span class="pre">2</span></tt> in contrast to the <tt class="docutils literal"><span class="pre">2.75</span></tt> returned by float true
division.  Note that <tt class="docutils literal"><span class="pre">(-11)</span> <span class="pre">//</span> <span class="pre">4</span></tt> is <tt class="docutils literal"><span class="pre">-3</span></tt> because that is <tt class="docutils literal"><span class="pre">-2.75</span></tt>
rounded <em>downward</em>. See <span class="target" id="index-4"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0238"><strong>PEP 238</strong></a>.</dd>
<dt id="term-function">function</dt>
<dd>A series of statements which returns some value to a caller. It can also
be passed zero or more <a class="reference internal" href="#term-argument"><em class="xref std std-term">arguments</em></a> which may be used in
the execution of the body. See also <a class="reference internal" href="#term-parameter"><em class="xref std std-term">parameter</em></a>, <a class="reference internal" href="#term-method"><em class="xref std std-term">method</em></a>,
and the <a class="reference internal" href="reference/compound_stmts.html#function"><em>Function definitions</em></a> section.</dd>
<dt id="term-function-annotation">function annotation</dt>
<dd><p class="first">An arbitrary metadata value associated with a function parameter or return
value. Its syntax is explained in section <a class="reference internal" href="reference/compound_stmts.html#function"><em>Function definitions</em></a>.  Annotations
may be accessed via the <tt class="xref py py-attr docutils literal"><span class="pre">__annotations__</span></tt> special attribute of a
function object.</p>
<p class="last">Python itself does not assign any particular meaning to function
annotations. They are intended to be interpreted by third-party libraries
or tools.  See <span class="target" id="index-5"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-3107"><strong>PEP 3107</strong></a>, which describes some of their potential uses.</p>
</dd>
<dt id="term-future">__future__</dt>
<dd><p class="first">A pseudo-module which programmers can use to enable new language features
which are not compatible with the current interpreter.</p>
<p>By importing the <a class="reference internal" href="library/__future__.html#module-__future__" title="__future__: Future statement definitions"><tt class="xref py py-mod docutils literal"><span class="pre">__future__</span></tt></a> module and evaluating its variables,
you can see when a new feature was first added to the language and when it
becomes the default:</p>
<div class="last highlight-python3"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">__future__</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">__future__</span><span class="o">.</span><span class="n">division</span>
<span class="go">_Feature((2, 2, 0, &#39;alpha&#39;, 2), (3, 0, 0, &#39;alpha&#39;, 0), 8192)</span>
</pre></div>
</div>
</dd>
<dt id="term-garbage-collection">garbage collection</dt>
<dd>The process of freeing memory when it is not used anymore.  Python
performs garbage collection via reference counting and a cyclic garbage
collector that is able to detect and break reference cycles.</dd>
<dt id="term-generator">generator</dt>
<dd>A function which returns an iterator.  It looks like a normal function
except that it contains <a class="reference internal" href="reference/simple_stmts.html#yield"><tt class="xref std std-keyword docutils literal"><span class="pre">yield</span></tt></a> statements for producing a series
a values usable in a for-loop or that can be retrieved one at a time with
the <a class="reference internal" href="library/functions.html#next" title="next"><tt class="xref py py-func docutils literal"><span class="pre">next()</span></tt></a> function. Each <a class="reference internal" href="reference/simple_stmts.html#yield"><tt class="xref std std-keyword docutils literal"><span class="pre">yield</span></tt></a> temporarily suspends
processing, remembering the location execution state (including local
variables and pending try-statements).  When the generator resumes, it
picks-up where it left-off (in contrast to functions which start fresh on
every invocation).</dd>
<dt id="term-generator-expression">generator expression</dt>
<dd><p class="first">An expression that returns an iterator.  It looks like a normal expression
followed by a <a class="reference internal" href="reference/compound_stmts.html#for"><tt class="xref std std-keyword docutils literal"><span class="pre">for</span></tt></a> expression defining a loop variable, range,
and an optional <a class="reference internal" href="reference/compound_stmts.html#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a> expression.  The combined expression
generates values for an enclosing function:</p>
<div class="last highlight-python3"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">sum</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">))</span>         <span class="c"># sum of squares 0, 1, 4, ... 81</span>
<span class="go">285</span>
</pre></div>
</div>
</dd>
<dt id="term-generic-function">generic function</dt>
<dd><p class="first">A function composed of multiple functions implementing the same operation
for different types. Which implementation should be used during a call is
determined by the dispatch algorithm.</p>
<p class="last">See also the <a class="reference internal" href="#term-single-dispatch"><em class="xref std std-term">single dispatch</em></a> glossary entry, the
<a class="reference internal" href="library/functools.html#functools.singledispatch" title="functools.singledispatch"><tt class="xref py py-func docutils literal"><span class="pre">functools.singledispatch()</span></tt></a> decorator, and <span class="target" id="index-8"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0443"><strong>PEP 443</strong></a>.</p>
</dd>
<dt id="term-gil">GIL</dt>
<dd>See <a class="reference internal" href="#term-global-interpreter-lock"><em class="xref std std-term">global interpreter lock</em></a>.</dd>
<dt id="term-global-interpreter-lock">global interpreter lock</dt>
<dd><p class="first">The mechanism used by the <a class="reference internal" href="#term-cpython"><em class="xref std std-term">CPython</em></a> interpreter to assure that
only one thread executes Python <a class="reference internal" href="#term-bytecode"><em class="xref std std-term">bytecode</em></a> at a time.
This simplifies the CPython implementation by making the object model
(including critical built-in types such as <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a>) implicitly
safe against concurrent access.  Locking the entire interpreter
makes it easier for the interpreter to be multi-threaded, at the
expense of much of the parallelism afforded by multi-processor
machines.</p>
<p>However, some extension modules, either standard or third-party,
are designed so as to release the GIL when doing computationally-intensive
tasks such as compression or hashing.  Also, the GIL is always released
when doing I/O.</p>
<p class="last">Past efforts to create a &#8220;free-threaded&#8221; interpreter (one which locks
shared data at a much finer granularity) have not been successful
because performance suffered in the common single-processor case. It
is believed that overcoming this performance issue would make the
implementation much more complicated and therefore costlier to maintain.</p>
</dd>
<dt id="term-hashable">hashable</dt>
<dd><p class="first">An object is <em>hashable</em> if it has a hash value which never changes during
its lifetime (it needs a <a class="reference internal" href="reference/datamodel.html#object.__hash__" title="object.__hash__"><tt class="xref py py-meth docutils literal"><span class="pre">__hash__()</span></tt></a> method), and can be compared to
other objects (it needs an <a class="reference internal" href="reference/datamodel.html#object.__eq__" title="object.__eq__"><tt class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></tt></a> method).  Hashable objects which
compare equal must have the same hash value.</p>
<p>Hashability makes an object usable as a dictionary key and a set member,
because these data structures use the hash value internally.</p>
<p class="last">All of Python&#8217;s immutable built-in objects are hashable, while no mutable
containers (such as lists or dictionaries) are.  Objects which are
instances of user-defined classes are hashable by default; they all
compare unequal (except with themselves), and their hash value is derived
from their <a class="reference internal" href="library/functions.html#id" title="id"><tt class="xref py py-func docutils literal"><span class="pre">id()</span></tt></a>.</p>
</dd>
<dt id="term-idle">IDLE</dt>
<dd>An Integrated Development Environment for Python.  IDLE is a basic editor
and interpreter environment which ships with the standard distribution of
Python.</dd>
<dt id="term-immutable">immutable</dt>
<dd>An object with a fixed value.  Immutable objects include numbers, strings and
tuples.  Such an object cannot be altered.  A new object has to
be created if a different value has to be stored.  They play an important
role in places where a constant hash value is needed, for example as a key
in a dictionary.</dd>
<dt id="term-import-path">import path</dt>
<dd>A list of locations (or <a class="reference internal" href="#term-path-entry"><em class="xref std std-term">path entries</em></a>) that are
searched by the <a class="reference internal" href="#term-path-based-finder"><em class="xref std std-term">path based finder</em></a> for modules to import. During
import, this list of locations usually comes from <a class="reference internal" href="library/sys.html#sys.path" title="sys.path"><tt class="xref py py-data docutils literal"><span class="pre">sys.path</span></tt></a>, but
for subpackages it may also come from the parent package&#8217;s <tt class="docutils literal"><span class="pre">__path__</span></tt>
attribute.</dd>
<dt id="term-importing">importing</dt>
<dd>The process by which Python code in one module is made available to
Python code in another module.</dd>
<dt id="term-importer">importer</dt>
<dd>An object that both finds and loads a module; both a
<a class="reference internal" href="#term-finder"><em class="xref std std-term">finder</em></a> and <a class="reference internal" href="#term-loader"><em class="xref std std-term">loader</em></a> object.</dd>
<dt id="term-interactive">interactive</dt>
<dd>Python has an interactive interpreter which means you can enter
statements and expressions at the interpreter prompt, immediately
execute them and see their results.  Just launch <tt class="docutils literal"><span class="pre">python</span></tt> with no
arguments (possibly by selecting it from your computer&#8217;s main
menu). It is a very powerful way to test out new ideas or inspect
modules and packages (remember <tt class="docutils literal"><span class="pre">help(x)</span></tt>).</dd>
<dt id="term-interpreted">interpreted</dt>
<dd>Python is an interpreted language, as opposed to a compiled one,
though the distinction can be blurry because of the presence of the
bytecode compiler.  This means that source files can be run directly
without explicitly creating an executable which is then run.
Interpreted languages typically have a shorter development/debug cycle
than compiled ones, though their programs generally also run more
slowly.  See also <a class="reference internal" href="#term-interactive"><em class="xref std std-term">interactive</em></a>.</dd>
<dt id="term-iterable">iterable</dt>
<dd>An object capable of returning its members one at a time. Examples of
iterables include all sequence types (such as <a class="reference internal" href="library/stdtypes.html#list" title="list"><tt class="xref py py-class docutils literal"><span class="pre">list</span></tt></a>, <a class="reference internal" href="library/stdtypes.html#str" title="str"><tt class="xref py py-class docutils literal"><span class="pre">str</span></tt></a>,
and <a class="reference internal" href="library/stdtypes.html#tuple" title="tuple"><tt class="xref py py-class docutils literal"><span class="pre">tuple</span></tt></a>) and some non-sequence types like <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a>,
<a class="reference internal" href="#term-file-object"><em class="xref std std-term">file objects</em></a>, and objects of any classes you define
with an <a class="reference internal" href="reference/datamodel.html#object.__iter__" title="object.__iter__"><tt class="xref py py-meth docutils literal"><span class="pre">__iter__()</span></tt></a> or <a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><tt class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></tt></a> method.  Iterables can be
used in a <a class="reference internal" href="reference/compound_stmts.html#for"><tt class="xref std std-keyword docutils literal"><span class="pre">for</span></tt></a> loop and in many other places where a sequence is
needed (<a class="reference internal" href="library/functions.html#zip" title="zip"><tt class="xref py py-func docutils literal"><span class="pre">zip()</span></tt></a>, <a class="reference internal" href="library/functions.html#map" title="map"><tt class="xref py py-func docutils literal"><span class="pre">map()</span></tt></a>, ...).  When an iterable object is passed
as an argument to the built-in function <a class="reference internal" href="library/functions.html#iter" title="iter"><tt class="xref py py-func docutils literal"><span class="pre">iter()</span></tt></a>, it returns an
iterator for the object.  This iterator is good for one pass over the set
of values.  When using iterables, it is usually not necessary to call
<a class="reference internal" href="library/functions.html#iter" title="iter"><tt class="xref py py-func docutils literal"><span class="pre">iter()</span></tt></a> or deal with iterator objects yourself.  The <tt class="docutils literal"><span class="pre">for</span></tt>
statement does that automatically for you, creating a temporary unnamed
variable to hold the iterator for the duration of the loop.  See also
<a class="reference internal" href="#term-iterator"><em class="xref std std-term">iterator</em></a>, <a class="reference internal" href="#term-sequence"><em class="xref std std-term">sequence</em></a>, and <a class="reference internal" href="#term-generator"><em class="xref std std-term">generator</em></a>.</dd>
<dt id="term-iterator">iterator</dt>
<dd><p class="first">An object representing a stream of data.  Repeated calls to the iterator&#8217;s
<a class="reference internal" href="library/stdtypes.html#iterator.__next__" title="iterator.__next__"><tt class="xref py py-meth docutils literal"><span class="pre">__next__()</span></tt></a> method (or passing it to the built-in function
<a class="reference internal" href="library/functions.html#next" title="next"><tt class="xref py py-func docutils literal"><span class="pre">next()</span></tt></a>) return successive items in the stream.  When no more data
are available a <a class="reference internal" href="library/exceptions.html#StopIteration" title="StopIteration"><tt class="xref py py-exc docutils literal"><span class="pre">StopIteration</span></tt></a> exception is raised instead.  At this
point, the iterator object is exhausted and any further calls to its
<tt class="xref py py-meth docutils literal"><span class="pre">__next__()</span></tt> method just raise <a class="reference internal" href="library/exceptions.html#StopIteration" title="StopIteration"><tt class="xref py py-exc docutils literal"><span class="pre">StopIteration</span></tt></a> again.  Iterators
are required to have an <a class="reference internal" href="reference/datamodel.html#object.__iter__" title="object.__iter__"><tt class="xref py py-meth docutils literal"><span class="pre">__iter__()</span></tt></a> method that returns the iterator
object itself so every iterator is also iterable and may be used in most
places where other iterables are accepted.  One notable exception is code
which attempts multiple iteration passes.  A container object (such as a
<a class="reference internal" href="library/stdtypes.html#list" title="list"><tt class="xref py py-class docutils literal"><span class="pre">list</span></tt></a>) produces a fresh new iterator each time you pass it to the
<a class="reference internal" href="library/functions.html#iter" title="iter"><tt class="xref py py-func docutils literal"><span class="pre">iter()</span></tt></a> function or use it in a <a class="reference internal" href="reference/compound_stmts.html#for"><tt class="xref std std-keyword docutils literal"><span class="pre">for</span></tt></a> loop.  Attempting this
with an iterator will just return the same exhausted iterator object used
in the previous iteration pass, making it appear like an empty container.</p>
<p class="last">More information can be found in <a class="reference internal" href="library/stdtypes.html#typeiter"><em>Iterator Types</em></a>.</p>
</dd>
<dt id="term-key-function">key function</dt>
<dd><p class="first">A key function or collation function is a callable that returns a value
used for sorting or ordering.  For example, <a class="reference internal" href="library/locale.html#locale.strxfrm" title="locale.strxfrm"><tt class="xref py py-func docutils literal"><span class="pre">locale.strxfrm()</span></tt></a> is
used to produce a sort key that is aware of locale specific sort
conventions.</p>
<p>A number of tools in Python accept key functions to control how elements
are ordered or grouped.  They include <a class="reference internal" href="library/functions.html#min" title="min"><tt class="xref py py-func docutils literal"><span class="pre">min()</span></tt></a>, <a class="reference internal" href="library/functions.html#max" title="max"><tt class="xref py py-func docutils literal"><span class="pre">max()</span></tt></a>,
<a class="reference internal" href="library/functions.html#sorted" title="sorted"><tt class="xref py py-func docutils literal"><span class="pre">sorted()</span></tt></a>, <a class="reference internal" href="library/stdtypes.html#list.sort" title="list.sort"><tt class="xref py py-meth docutils literal"><span class="pre">list.sort()</span></tt></a>, <a class="reference internal" href="library/heapq.html#heapq.nsmallest" title="heapq.nsmallest"><tt class="xref py py-func docutils literal"><span class="pre">heapq.nsmallest()</span></tt></a>,
<a class="reference internal" href="library/heapq.html#heapq.nlargest" title="heapq.nlargest"><tt class="xref py py-func docutils literal"><span class="pre">heapq.nlargest()</span></tt></a>, and <a class="reference internal" href="library/itertools.html#itertools.groupby" title="itertools.groupby"><tt class="xref py py-func docutils literal"><span class="pre">itertools.groupby()</span></tt></a>.</p>
<p class="last">There are several ways to create a key function.  For example. the
<a class="reference internal" href="library/stdtypes.html#str.lower" title="str.lower"><tt class="xref py py-meth docutils literal"><span class="pre">str.lower()</span></tt></a> method can serve as a key function for case insensitive
sorts.  Alternatively, an ad-hoc key function can be built from a
<a class="reference internal" href="reference/expressions.html#lambda"><tt class="xref std std-keyword docutils literal"><span class="pre">lambda</span></tt></a> expression such as <tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">r:</span> <span class="pre">(r[0],</span> <span class="pre">r[2])</span></tt>.  Also,
the <a class="reference internal" href="library/operator.html#module-operator" title="operator: Functions corresponding to the standard operators."><tt class="xref py py-mod docutils literal"><span class="pre">operator</span></tt></a> module provides three key function constructors:
<a class="reference internal" href="library/operator.html#operator.attrgetter" title="operator.attrgetter"><tt class="xref py py-func docutils literal"><span class="pre">attrgetter()</span></tt></a>, <a class="reference internal" href="library/operator.html#operator.itemgetter" title="operator.itemgetter"><tt class="xref py py-func docutils literal"><span class="pre">itemgetter()</span></tt></a>, and
<a class="reference internal" href="library/operator.html#operator.methodcaller" title="operator.methodcaller"><tt class="xref py py-func docutils literal"><span class="pre">methodcaller()</span></tt></a>.  See the <a class="reference internal" href="howto/sorting.html#sortinghowto"><em>Sorting HOW TO</em></a> for examples of how to create and use key functions.</p>
</dd>
<dt id="term-keyword-argument">keyword argument</dt>
<dd>See <a class="reference internal" href="#term-argument"><em class="xref std std-term">argument</em></a>.</dd>
<dt id="term-lambda">lambda</dt>
<dd>An anonymous inline function consisting of a single <a class="reference internal" href="#term-expression"><em class="xref std std-term">expression</em></a>
which is evaluated when the function is called.  The syntax to create
a lambda function is <tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">[arguments]:</span> <span class="pre">expression</span></tt></dd>
<dt id="term-lbyl">LBYL</dt>
<dd><p class="first">Look before you leap.  This coding style explicitly tests for
pre-conditions before making calls or lookups.  This style contrasts with
the <a class="reference internal" href="#term-eafp"><em class="xref std std-term">EAFP</em></a> approach and is characterized by the presence of many
<a class="reference internal" href="reference/compound_stmts.html#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a> statements.</p>
<p class="last">In a multi-threaded environment, the LBYL approach can risk introducing a
race condition between &#8220;the looking&#8221; and &#8220;the leaping&#8221;.  For example, the
code, <tt class="docutils literal"><span class="pre">if</span> <span class="pre">key</span> <span class="pre">in</span> <span class="pre">mapping:</span> <span class="pre">return</span> <span class="pre">mapping[key]</span></tt> can fail if another
thread removes <em>key</em> from <em>mapping</em> after the test, but before the lookup.
This issue can be solved with locks or by using the EAFP approach.</p>
</dd>
<dt id="term-list">list</dt>
<dd>A built-in Python <a class="reference internal" href="#term-sequence"><em class="xref std std-term">sequence</em></a>.  Despite its name it is more akin
to an array in other languages than to a linked list since access to
elements are O(1).</dd>
<dt id="term-list-comprehension">list comprehension</dt>
<dd>A compact way to process all or part of the elements in a sequence and
return a list with the results.  <tt class="docutils literal"><span class="pre">result</span> <span class="pre">=</span> <span class="pre">['{:#04x}'.format(x)</span> <span class="pre">for</span> <span class="pre">x</span> <span class="pre">in</span>
<span class="pre">range(256)</span> <span class="pre">if</span> <span class="pre">x</span> <span class="pre">%</span> <span class="pre">2</span> <span class="pre">==</span> <span class="pre">0]</span></tt> generates a list of strings containing
even hex numbers (0x..) in the range from 0 to 255. The <a class="reference internal" href="reference/compound_stmts.html#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a>
clause is optional.  If omitted, all elements in <tt class="docutils literal"><span class="pre">range(256)</span></tt> are
processed.</dd>
<dt id="term-loader">loader</dt>
<dd>An object that loads a module. It must define a method named
<tt class="xref py py-meth docutils literal"><span class="pre">load_module()</span></tt>. A loader is typically returned by a
<a class="reference internal" href="#term-finder"><em class="xref std std-term">finder</em></a>. See <span class="target" id="index-9"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0302"><strong>PEP 302</strong></a> for details and
<a class="reference internal" href="library/importlib.html#importlib.abc.Loader" title="importlib.abc.Loader"><tt class="xref py py-class docutils literal"><span class="pre">importlib.abc.Loader</span></tt></a> for an <a class="reference internal" href="#term-abstract-base-class"><em class="xref std std-term">abstract base class</em></a>.</dd>
<dt id="term-mapping">mapping</dt>
<dd>A container object that supports arbitrary key lookups and implements the
methods specified in the <a class="reference internal" href="library/collections.abc.html#collections.abc.Mapping" title="collections.abc.Mapping"><tt class="xref py py-class docutils literal"><span class="pre">Mapping</span></tt></a> or
<a class="reference internal" href="library/collections.abc.html#collections.abc.MutableMapping" title="collections.abc.MutableMapping"><tt class="xref py py-class docutils literal"><span class="pre">MutableMapping</span></tt></a>
<a class="reference internal" href="library/collections.abc.html#collections-abstract-base-classes"><em>abstract base classes</em></a>.  Examples
include <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a>, <a class="reference internal" href="library/collections.html#collections.defaultdict" title="collections.defaultdict"><tt class="xref py py-class docutils literal"><span class="pre">collections.defaultdict</span></tt></a>,
<a class="reference internal" href="library/collections.html#collections.OrderedDict" title="collections.OrderedDict"><tt class="xref py py-class docutils literal"><span class="pre">collections.OrderedDict</span></tt></a> and <a class="reference internal" href="library/collections.html#collections.Counter" title="collections.Counter"><tt class="xref py py-class docutils literal"><span class="pre">collections.Counter</span></tt></a>.</dd>
<dt id="term-meta-path-finder">meta path finder</dt>
<dd>A finder returned by a search of <a class="reference internal" href="library/sys.html#sys.meta_path" title="sys.meta_path"><tt class="xref py py-data docutils literal"><span class="pre">sys.meta_path</span></tt></a>.  Meta path
finders are related to, but different from <a class="reference internal" href="#term-path-entry-finder"><em class="xref std std-term">path entry finders</em></a>.</dd>
<dt id="term-metaclass">metaclass</dt>
<dd><p class="first">The class of a class.  Class definitions create a class name, a class
dictionary, and a list of base classes.  The metaclass is responsible for
taking those three arguments and creating the class.  Most object oriented
programming languages provide a default implementation.  What makes Python
special is that it is possible to create custom metaclasses.  Most users
never need this tool, but when the need arises, metaclasses can provide
powerful, elegant solutions.  They have been used for logging attribute
access, adding thread-safety, tracking object creation, implementing
singletons, and many other tasks.</p>
<p class="last">More information can be found in <a class="reference internal" href="reference/datamodel.html#metaclasses"><em>Customizing class creation</em></a>.</p>
</dd>
<dt id="term-method">method</dt>
<dd>A function which is defined inside a class body.  If called as an attribute
of an instance of that class, the method will get the instance object as
its first <a class="reference internal" href="#term-argument"><em class="xref std std-term">argument</em></a> (which is usually called <tt class="docutils literal"><span class="pre">self</span></tt>).
See <a class="reference internal" href="#term-function"><em class="xref std std-term">function</em></a> and <a class="reference internal" href="#term-nested-scope"><em class="xref std std-term">nested scope</em></a>.</dd>
<dt id="term-method-resolution-order">method resolution order</dt>
<dd>Method Resolution Order is the order in which base classes are searched
for a member during lookup. See <a class="reference external" href="http://www.python.org/download/releases/2.3/mro/">The Python 2.3 Method Resolution Order</a>.</dd>
<dt id="term-module">module</dt>
<dd><p class="first">An object that serves as an organizational unit of Python code.  Modules
have a namespace containing arbitrary Python objects.  Modules are loaded
into Python by the process of <a class="reference internal" href="#term-importing"><em class="xref std std-term">importing</em></a>.</p>
<p class="last">See also <a class="reference internal" href="#term-package"><em class="xref std std-term">package</em></a>.</p>
</dd>
<dt id="term-module-spec">module spec</dt>
<dd>A namespace containing the import-related information used to load a
module.</dd>
<dt id="term-mro">MRO</dt>
<dd>See <a class="reference internal" href="#term-method-resolution-order"><em class="xref std std-term">method resolution order</em></a>.</dd>
<dt id="term-mutable">mutable</dt>
<dd>Mutable objects can change their value but keep their <a class="reference internal" href="library/functions.html#id" title="id"><tt class="xref py py-func docutils literal"><span class="pre">id()</span></tt></a>.  See
also <a class="reference internal" href="#term-immutable"><em class="xref std std-term">immutable</em></a>.</dd>
<dt id="term-named-tuple">named tuple</dt>
<dd><p class="first">Any tuple-like class whose indexable elements are also accessible using
named attributes (for example, <a class="reference internal" href="library/time.html#time.localtime" title="time.localtime"><tt class="xref py py-func docutils literal"><span class="pre">time.localtime()</span></tt></a> returns a
tuple-like object where the <em>year</em> is accessible either with an
index such as <tt class="docutils literal"><span class="pre">t[0]</span></tt> or with a named attribute like <tt class="docutils literal"><span class="pre">t.tm_year</span></tt>).</p>
<p class="last">A named tuple can be a built-in type such as <a class="reference internal" href="library/time.html#time.struct_time" title="time.struct_time"><tt class="xref py py-class docutils literal"><span class="pre">time.struct_time</span></tt></a>,
or it can be created with a regular class definition.  A full featured
named tuple can also be created with the factory function
<a class="reference internal" href="library/collections.html#collections.namedtuple" title="collections.namedtuple"><tt class="xref py py-func docutils literal"><span class="pre">collections.namedtuple()</span></tt></a>.  The latter approach automatically
provides extra features such as a self-documenting representation like
<tt class="docutils literal"><span class="pre">Employee(name='jones',</span> <span class="pre">title='programmer')</span></tt>.</p>
</dd>
<dt id="term-namespace">namespace</dt>
<dd>The place where a variable is stored.  Namespaces are implemented as
dictionaries.  There are the local, global and built-in namespaces as well
as nested namespaces in objects (in methods).  Namespaces support
modularity by preventing naming conflicts.  For instance, the functions
<a class="reference internal" href="library/functions.html#open" title="open"><tt class="xref py py-func docutils literal"><span class="pre">builtins.open</span></tt></a> and <a class="reference internal" href="library/os.html#os.open" title="os.open"><tt class="xref py py-func docutils literal"><span class="pre">os.open()</span></tt></a> are distinguished by
their namespaces.  Namespaces also aid readability and maintainability by
making it clear which module implements a function.  For instance, writing
<a class="reference internal" href="library/random.html#random.seed" title="random.seed"><tt class="xref py py-func docutils literal"><span class="pre">random.seed()</span></tt></a> or <a class="reference internal" href="library/itertools.html#itertools.islice" title="itertools.islice"><tt class="xref py py-func docutils literal"><span class="pre">itertools.islice()</span></tt></a> makes it clear that those
functions are implemented by the <a class="reference internal" href="library/random.html#module-random" title="random: Generate pseudo-random numbers with various common distributions."><tt class="xref py py-mod docutils literal"><span class="pre">random</span></tt></a> and <a class="reference internal" href="library/itertools.html#module-itertools" title="itertools: Functions creating iterators for efficient looping."><tt class="xref py py-mod docutils literal"><span class="pre">itertools</span></tt></a>
modules, respectively.</dd>
<dt id="term-namespace-package">namespace package</dt>
<dd><p class="first">A <span class="target" id="index-10"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0420"><strong>PEP 420</strong></a> <a class="reference internal" href="#term-package"><em class="xref std std-term">package</em></a> which serves only as a container for
subpackages.  Namespace packages may have no physical representation,
and specifically are not like a <a class="reference internal" href="#term-regular-package"><em class="xref std std-term">regular package</em></a> because they
have no <tt class="docutils literal"><span class="pre">__init__.py</span></tt> file.</p>
<p class="last">See also <a class="reference internal" href="#term-module"><em class="xref std std-term">module</em></a>.</p>
</dd>
<dt id="term-nested-scope">nested scope</dt>
<dd>The ability to refer to a variable in an enclosing definition.  For
instance, a function defined inside another function can refer to
variables in the outer function.  Note that nested scopes by default work
only for reference and not for assignment.  Local variables both read and
write in the innermost scope.  Likewise, global variables read and write
to the global namespace.  The <a class="reference internal" href="reference/simple_stmts.html#nonlocal"><tt class="xref std std-keyword docutils literal"><span class="pre">nonlocal</span></tt></a> allows writing to outer
scopes.</dd>
<dt id="term-new-style-class">new-style class</dt>
<dd>Old name for the flavor of classes now used for all class objects.  In
earlier Python versions, only new-style classes could use Python&#8217;s newer,
versatile features like <a class="reference internal" href="reference/datamodel.html#object.__slots__" title="object.__slots__"><tt class="xref py py-attr docutils literal"><span class="pre">__slots__</span></tt></a>, descriptors,
properties, <a class="reference internal" href="reference/datamodel.html#object.__getattribute__" title="object.__getattribute__"><tt class="xref py py-meth docutils literal"><span class="pre">__getattribute__()</span></tt></a>, class methods, and static methods.</dd>
<dt id="term-object">object</dt>
<dd>Any data with state (attributes or value) and defined behavior
(methods).  Also the ultimate base class of any <a class="reference internal" href="#term-new-style-class"><em class="xref std std-term">new-style
class</em></a>.</dd>
<dt id="term-package">package</dt>
<dd><p class="first">A Python <a class="reference internal" href="#term-module"><em class="xref std std-term">module</em></a> which can contain submodules or recursively,
subpackages.  Technically, a package is a Python module with an
<tt class="docutils literal"><span class="pre">__path__</span></tt> attribute.</p>
<p class="last">See also <a class="reference internal" href="#term-regular-package"><em class="xref std std-term">regular package</em></a> and <a class="reference internal" href="#term-namespace-package"><em class="xref std std-term">namespace package</em></a>.</p>
</dd>
<dt id="term-parameter">parameter</dt>
<dd><p class="first">A named entity in a <a class="reference internal" href="#term-function"><em class="xref std std-term">function</em></a> (or method) definition that
specifies an <a class="reference internal" href="#term-argument"><em class="xref std std-term">argument</em></a> (or in some cases, arguments) that the
function can accept.  There are five kinds of parameter:</p>
<ul>
<li><p class="first"><em class="dfn">positional-or-keyword</em>: specifies an argument that can be passed
either <a class="reference internal" href="#term-argument"><em class="xref std std-term">positionally</em></a> or as a <a class="reference internal" href="#term-argument"><em class="xref std std-term">keyword argument</em></a>.  This is the default kind of parameter, for example <em>foo</em>
and <em>bar</em> in the following:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="n">bar</span><span class="o">=</span><span class="k">None</span><span class="p">):</span> <span class="o">...</span>
</pre></div>
</div>
</li>
<li><p class="first"><em class="dfn">positional-only</em>: specifies an argument that can be supplied only
by position.  Python has no syntax for defining positional-only
parameters.  However, some built-in functions have positional-only
parameters (e.g. <a class="reference internal" href="library/functions.html#abs" title="abs"><tt class="xref py py-func docutils literal"><span class="pre">abs()</span></tt></a>).</p>
</li>
</ul>
<ul id="keyword-only-parameter">
<li><p class="first"><em class="dfn">keyword-only</em>: specifies an argument that can be supplied only
by keyword.  Keyword-only parameters can be defined by including a
single var-positional parameter or bare <tt class="docutils literal"><span class="pre">*</span></tt> in the parameter list
of the function definition before them, for example <em>kw_only1</em> and
<em>kw_only2</em> in the following:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">kw_only1</span><span class="p">,</span> <span class="n">kw_only2</span><span class="p">):</span> <span class="o">...</span>
</pre></div>
</div>
</li>
<li><p class="first"><em class="dfn">var-positional</em>: specifies that an arbitrary sequence of
positional arguments can be provided (in addition to any positional
arguments already accepted by other parameters).  Such a parameter can
be defined by prepending the parameter name with <tt class="docutils literal"><span class="pre">*</span></tt>, for example
<em>args</em> in the following:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="o">...</span>
</pre></div>
</div>
</li>
<li><p class="first"><em class="dfn">var-keyword</em>: specifies that arbitrarily many keyword arguments
can be provided (in addition to any keyword arguments already accepted
by other parameters).  Such a parameter can be defined by prepending
the parameter name with <tt class="docutils literal"><span class="pre">**</span></tt>, for example <em>kwargs</em> in the example
above.</p>
</li>
</ul>
<p>Parameters can specify both optional and required arguments, as well as
default values for some optional arguments.</p>
<p class="last">See also the <a class="reference internal" href="#term-argument"><em class="xref std std-term">argument</em></a> glossary entry, the FAQ question on
<a class="reference internal" href="faq/programming.html#faq-argument-vs-parameter"><em>the difference between arguments and parameters</em></a>, the <a class="reference internal" href="library/inspect.html#inspect.Parameter" title="inspect.Parameter"><tt class="xref py py-class docutils literal"><span class="pre">inspect.Parameter</span></tt></a> class, the
<a class="reference internal" href="reference/compound_stmts.html#function"><em>Function definitions</em></a> section, and <span class="target" id="index-11"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0362"><strong>PEP 362</strong></a>.</p>
</dd>
<dt id="term-path-entry">path entry</dt>
<dd>A single location on the <a class="reference internal" href="#term-import-path"><em class="xref std std-term">import path</em></a> which the <a class="reference internal" href="#term-path-based-finder"><em class="xref std std-term">path
based finder</em></a> consults to find modules for importing.</dd>
<dt id="term-path-entry-finder">path entry finder</dt>
<dd>A <a class="reference internal" href="#term-finder"><em class="xref std std-term">finder</em></a> returned by a callable on <a class="reference internal" href="library/sys.html#sys.path_hooks" title="sys.path_hooks"><tt class="xref py py-data docutils literal"><span class="pre">sys.path_hooks</span></tt></a>
(i.e. a <a class="reference internal" href="#term-path-entry-hook"><em class="xref std std-term">path entry hook</em></a>) which knows how to locate modules given
a <a class="reference internal" href="#term-path-entry"><em class="xref std std-term">path entry</em></a>.</dd>
<dt id="term-path-entry-hook">path entry hook</dt>
<dd>A callable on the <tt class="xref py py-data docutils literal"><span class="pre">sys.path_hook</span></tt> list which returns a <a class="reference internal" href="#term-path-entry-finder"><em class="xref std std-term">path
entry finder</em></a> if it knows how to find modules on a specific <a class="reference internal" href="#term-path-entry"><em class="xref std std-term">path
entry</em></a>.</dd>
<dt id="term-path-based-finder">path based finder</dt>
<dd>One of the default <a class="reference internal" href="#term-meta-path-finder"><em class="xref std std-term">meta path finders</em></a> which
searches an <a class="reference internal" href="#term-import-path"><em class="xref std std-term">import path</em></a> for modules.</dd>
<dt id="term-portion">portion</dt>
<dd>A set of files in a single directory (possibly stored in a zip file)
that contribute to a namespace package, as defined in <span class="target" id="index-12"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0420"><strong>PEP 420</strong></a>.</dd>
<dt id="term-positional-argument">positional argument</dt>
<dd>See <a class="reference internal" href="#term-argument"><em class="xref std std-term">argument</em></a>.</dd>
<dt id="term-provisional-api">provisional API</dt>
<dd><p class="first">A provisional API is one which has been deliberately excluded from
the standard library&#8217;s backwards compatibility guarantees.  While major
changes to such interfaces are not expected, as long as they are marked
provisional, backwards incompatible changes (up to and including removal
of the interface) may occur if deemed necessary by core developers.  Such
changes will not be made gratuitously &#8211; they will occur only if serious
fundamental flaws are uncovered that were missed prior to the inclusion
of the API.</p>
<p>Even for provisional APIs, backwards incompatible changes are seen as
a &#8220;solution of last resort&#8221; - every attempt will still be made to find
a backwards compatible resolution to any identified problems.</p>
<p class="last">This process allows the standard library to continue to evolve over
time, without locking in problematic design errors for extended periods
of time.  See <span class="target" id="index-13"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0411"><strong>PEP 411</strong></a> for more details.</p>
</dd>
<dt id="term-provisional-package">provisional package</dt>
<dd>See <a class="reference internal" href="#term-provisional-api"><em class="xref std std-term">provisional API</em></a>.</dd>
<dt id="term-python-3000">Python 3000</dt>
<dd>Nickname for the Python 3.x release line (coined long ago when the
release of version 3 was something in the distant future.)  This is also
abbreviated &#8220;Py3k&#8221;.</dd>
<dt id="term-pythonic">Pythonic</dt>
<dd><p class="first">An idea or piece of code which closely follows the most common idioms
of the Python language, rather than implementing code using concepts
common to other languages.  For example, a common idiom in Python is
to loop over all elements of an iterable using a <a class="reference internal" href="reference/compound_stmts.html#for"><tt class="xref std std-keyword docutils literal"><span class="pre">for</span></tt></a>
statement.  Many other languages don&#8217;t have this type of construct, so
people unfamiliar with Python sometimes use a numerical counter instead:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">food</span><span class="p">)):</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">food</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
</pre></div>
</div>
<p>As opposed to the cleaner, Pythonic method:</p>
<div class="last highlight-python3"><div class="highlight"><pre><span class="k">for</span> <span class="n">piece</span> <span class="ow">in</span> <span class="n">food</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="n">piece</span><span class="p">)</span>
</pre></div>
</div>
</dd>
<dt id="term-qualified-name">qualified name</dt>
<dd><p class="first">A dotted name showing the &#8220;path&#8221; from a module&#8217;s global scope to a
class, function or method defined in that module, as defined in
<span class="target" id="index-14"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-3155"><strong>PEP 3155</strong></a>.  For top-level functions and classes, the qualified name
is the same as the object&#8217;s name:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">C</span><span class="p">:</span>
<span class="gp">... </span>    <span class="k">class</span> <span class="nc">D</span><span class="p">:</span>
<span class="gp">... </span>        <span class="k">def</span> <span class="nf">meth</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="gp">... </span>            <span class="k">pass</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span><span class="o">.</span><span class="n">__qualname__</span>
<span class="go">&#39;C&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span><span class="o">.</span><span class="n">D</span><span class="o">.</span><span class="n">__qualname__</span>
<span class="go">&#39;C.D&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">C</span><span class="o">.</span><span class="n">D</span><span class="o">.</span><span class="n">meth</span><span class="o">.</span><span class="n">__qualname__</span>
<span class="go">&#39;C.D.meth&#39;</span>
</pre></div>
</div>
<p>When used to refer to modules, the <em>fully qualified name</em> means the
entire dotted path to the module, including any parent packages,
e.g. <tt class="docutils literal"><span class="pre">email.mime.text</span></tt>:</p>
<div class="last highlight-python3"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">email.mime.text</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">email</span><span class="o">.</span><span class="n">mime</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">__name__</span>
<span class="go">&#39;email.mime.text&#39;</span>
</pre></div>
</div>
</dd>
<dt id="term-reference-count">reference count</dt>
<dd>The number of references to an object.  When the reference count of an
object drops to zero, it is deallocated.  Reference counting is
generally not visible to Python code, but it is a key element of the
<a class="reference internal" href="#term-cpython"><em class="xref std std-term">CPython</em></a> implementation.  The <a class="reference internal" href="library/sys.html#module-sys" title="sys: Access system-specific parameters and functions."><tt class="xref py py-mod docutils literal"><span class="pre">sys</span></tt></a> module defines a
<a class="reference internal" href="library/sys.html#sys.getrefcount" title="sys.getrefcount"><tt class="xref py py-func docutils literal"><span class="pre">getrefcount()</span></tt></a> function that programmers can call to return the
reference count for a particular object.</dd>
<dt id="term-regular-package">regular package</dt>
<dd><p class="first">A traditional <a class="reference internal" href="#term-package"><em class="xref std std-term">package</em></a>, such as a directory containing an
<tt class="docutils literal"><span class="pre">__init__.py</span></tt> file.</p>
<p class="last">See also <a class="reference internal" href="#term-namespace-package"><em class="xref std std-term">namespace package</em></a>.</p>
</dd>
<dt id="term-slots">__slots__</dt>
<dd>A declaration inside a class that saves memory by pre-declaring space for
instance attributes and eliminating instance dictionaries.  Though
popular, the technique is somewhat tricky to get right and is best
reserved for rare cases where there are large numbers of instances in a
memory-critical application.</dd>
<dt id="term-sequence">sequence</dt>
<dd><p class="first">An <a class="reference internal" href="#term-iterable"><em class="xref std std-term">iterable</em></a> which supports efficient element access using integer
indices via the <a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><tt class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></tt></a> special method and defines a
<a class="reference internal" href="reference/datamodel.html#object.__len__" title="object.__len__"><tt class="xref py py-meth docutils literal"><span class="pre">__len__()</span></tt></a> method that returns the length of the sequence.
Some built-in sequence types are <a class="reference internal" href="library/stdtypes.html#list" title="list"><tt class="xref py py-class docutils literal"><span class="pre">list</span></tt></a>, <a class="reference internal" href="library/stdtypes.html#str" title="str"><tt class="xref py py-class docutils literal"><span class="pre">str</span></tt></a>,
<a class="reference internal" href="library/stdtypes.html#tuple" title="tuple"><tt class="xref py py-class docutils literal"><span class="pre">tuple</span></tt></a>, and <a class="reference internal" href="library/functions.html#bytes" title="bytes"><tt class="xref py py-class docutils literal"><span class="pre">bytes</span></tt></a>. Note that <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></a> also
supports <a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><tt class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></tt></a> and <a class="reference internal" href="reference/datamodel.html#object.__len__" title="object.__len__"><tt class="xref py py-meth docutils literal"><span class="pre">__len__()</span></tt></a>, but is considered a
mapping rather than a sequence because the lookups use arbitrary
<a class="reference internal" href="#term-immutable"><em class="xref std std-term">immutable</em></a> keys rather than integers.</p>
<p class="last">The <a class="reference internal" href="library/collections.abc.html#collections.abc.Sequence" title="collections.abc.Sequence"><tt class="xref py py-class docutils literal"><span class="pre">collections.abc.Sequence</span></tt></a> abstract base class
defines a much richer interface that goes beyond just
<a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><tt class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></tt></a> and <a class="reference internal" href="reference/datamodel.html#object.__len__" title="object.__len__"><tt class="xref py py-meth docutils literal"><span class="pre">__len__()</span></tt></a>, adding <tt class="xref py py-meth docutils literal"><span class="pre">count()</span></tt>,
<tt class="xref py py-meth docutils literal"><span class="pre">index()</span></tt>, <a class="reference internal" href="reference/datamodel.html#object.__contains__" title="object.__contains__"><tt class="xref py py-meth docutils literal"><span class="pre">__contains__()</span></tt></a>, and
<a class="reference internal" href="reference/datamodel.html#object.__reversed__" title="object.__reversed__"><tt class="xref py py-meth docutils literal"><span class="pre">__reversed__()</span></tt></a>. Types that implement this expanded
interface can be registered explicitly using
<tt class="xref py py-func docutils literal"><span class="pre">register()</span></tt>.</p>
</dd>
<dt id="term-single-dispatch">single dispatch</dt>
<dd>A form of <a class="reference internal" href="#term-generic-function"><em class="xref std std-term">generic function</em></a> dispatch where the implementation is
chosen based on the type of a single argument.</dd>
<dt id="term-slice">slice</dt>
<dd>An object usually containing a portion of a <a class="reference internal" href="#term-sequence"><em class="xref std std-term">sequence</em></a>.  A slice is
created using the subscript notation, <tt class="docutils literal"><span class="pre">[]</span></tt> with colons between numbers
when several are given, such as in <tt class="docutils literal"><span class="pre">variable_name[1:3:5]</span></tt>.  The bracket
(subscript) notation uses <a class="reference internal" href="library/functions.html#slice" title="slice"><tt class="xref py py-class docutils literal"><span class="pre">slice</span></tt></a> objects internally.</dd>
<dt id="term-special-method">special method</dt>
<dd>A method that is called implicitly by Python to execute a certain
operation on a type, such as addition.  Such methods have names starting
and ending with double underscores.  Special methods are documented in
<a class="reference internal" href="reference/datamodel.html#specialnames"><em>Special method names</em></a>.</dd>
<dt id="term-statement">statement</dt>
<dd>A statement is part of a suite (a &#8220;block&#8221; of code).  A statement is either
an <a class="reference internal" href="#term-expression"><em class="xref std std-term">expression</em></a> or one of several constructs with a keyword, such
as <a class="reference internal" href="reference/compound_stmts.html#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a>, <a class="reference internal" href="reference/compound_stmts.html#while"><tt class="xref std std-keyword docutils literal"><span class="pre">while</span></tt></a> or <a class="reference internal" href="reference/compound_stmts.html#for"><tt class="xref std std-keyword docutils literal"><span class="pre">for</span></tt></a>.</dd>
<dt id="term-struct-sequence">struct sequence</dt>
<dd>A tuple with named elements. Struct sequences expose an interface similar
to <a class="reference internal" href="#term-named-tuple"><em class="xref std std-term">named tuple</em></a> in that elements can either be accessed either by
index or as an attribute. However, they do not have any of the named tuple
methods like <a class="reference internal" href="library/collections.html#collections.somenamedtuple._make" title="collections.somenamedtuple._make"><tt class="xref py py-meth docutils literal"><span class="pre">_make()</span></tt></a> or
<a class="reference internal" href="library/collections.html#collections.somenamedtuple._asdict" title="collections.somenamedtuple._asdict"><tt class="xref py py-meth docutils literal"><span class="pre">_asdict()</span></tt></a>. Examples of struct sequences
include <a class="reference internal" href="library/sys.html#sys.float_info" title="sys.float_info"><tt class="xref py py-data docutils literal"><span class="pre">sys.float_info</span></tt></a> and the return value of <a class="reference internal" href="library/os.html#os.stat" title="os.stat"><tt class="xref py py-func docutils literal"><span class="pre">os.stat()</span></tt></a>.</dd>
<dt id="term-text-file">text file</dt>
<dd><p class="first">A <a class="reference internal" href="#term-file-object"><em class="xref std std-term">file object</em></a> able to read and write <a class="reference internal" href="library/stdtypes.html#str" title="str"><tt class="xref py py-class docutils literal"><span class="pre">str</span></tt></a> objects.
Often, a text file actually accesses a byte-oriented datastream
and handles the text encoding automatically.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">A <a class="reference internal" href="#term-binary-file"><em class="xref std std-term">binary file</em></a> reads and write <a class="reference internal" href="library/functions.html#bytes" title="bytes"><tt class="xref py py-class docutils literal"><span class="pre">bytes</span></tt></a> objects.</p>
</div>
</dd>
<dt id="term-triple-quoted-string">triple-quoted string</dt>
<dd>A string which is bound by three instances of either a quotation mark
(&#8221;) or an apostrophe (&#8216;).  While they don&#8217;t provide any functionality
not available with single-quoted strings, they are useful for a number
of reasons.  They allow you to include unescaped single and double
quotes within a string and they can span multiple lines without the
use of the continuation character, making them especially useful when
writing docstrings.</dd>
<dt id="term-type">type</dt>
<dd>The type of a Python object determines what kind of object it is; every
object has a type.  An object&#8217;s type is accessible as its
<a class="reference internal" href="library/stdtypes.html#instance.__class__" title="instance.__class__"><tt class="xref py py-attr docutils literal"><span class="pre">__class__</span></tt></a> attribute or can be retrieved with
<tt class="docutils literal"><span class="pre">type(obj)</span></tt>.</dd>
<dt id="term-universal-newlines">universal newlines</dt>
<dd>A manner of interpreting text streams in which all of the following are
recognized as ending a line: the Unix end-of-line convention <tt class="docutils literal"><span class="pre">'\n'</span></tt>,
the Windows convention <tt class="docutils literal"><span class="pre">'\r\n'</span></tt>, and the old Macintosh convention
<tt class="docutils literal"><span class="pre">'\r'</span></tt>.  See <span class="target" id="index-15"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-0278"><strong>PEP 278</strong></a> and <span class="target" id="index-16"></span><a class="pep reference external" href="http://www.python.org/dev/peps/pep-3116"><strong>PEP 3116</strong></a>, as well as
<a class="reference internal" href="library/stdtypes.html#bytes.splitlines" title="bytes.splitlines"><tt class="xref py py-func docutils literal"><span class="pre">bytes.splitlines()</span></tt></a> for an additional use.</dd>
<dt id="term-view">view</dt>
<dd>The objects returned from <a class="reference internal" href="library/stdtypes.html#dict.keys" title="dict.keys"><tt class="xref py py-meth docutils literal"><span class="pre">dict.keys()</span></tt></a>, <a class="reference internal" href="library/stdtypes.html#dict.values" title="dict.values"><tt class="xref py py-meth docutils literal"><span class="pre">dict.values()</span></tt></a>, and
<a class="reference internal" href="library/stdtypes.html#dict.items" title="dict.items"><tt class="xref py py-meth docutils literal"><span class="pre">dict.items()</span></tt></a> are called dictionary views.  They are lazy sequences
that will see changes in the underlying dictionary.  To force the
dictionary view to become a full list use <tt class="docutils literal"><span class="pre">list(dictview)</span></tt>.  See
<a class="reference internal" href="library/stdtypes.html#dict-views"><em>Dictionary view objects</em></a>.</dd>
<dt id="term-virtual-environment">virtual environment</dt>
<dd><p class="first">A cooperatively isolated runtime environment that allows Python users
and applications to install and upgrade Python distribution packages
without interfering with the behaviour of other Python applications
running on the same system.</p>
<p class="last">See also <a class="reference internal" href="using/scripts.html#scripts-pyvenv"><em>pyvenv - Creating virtual environments</em></a></p>
</dd>
<dt id="term-virtual-machine">virtual machine</dt>
<dd>A computer defined entirely in software.  Python&#8217;s virtual machine
executes the <a class="reference internal" href="#term-bytecode"><em class="xref std std-term">bytecode</em></a> emitted by the bytecode compiler.</dd>
<dt id="term-zen-of-python">Zen of Python</dt>
<dd>Listing of Python design principles and philosophies that are helpful in
understanding and using the language.  The listing can be found by typing
&#8220;<tt class="docutils literal"><span class="pre">import</span> <span class="pre">this</span></tt>&#8221; at the interactive prompt.</dd>
</dl>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="faq/installed.html"
                        title="previous chapter">&#8220;Why is Python Installed on my Computer?&#8221; FAQ</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="about.html"
                        title="next chapter">About these documents</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="bugs.html">Report a Bug</a></li>
  <li><a href="_sources/glossary.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="about.html" title="About these documents"
             >next</a> |</li>
        <li class="right" >
          <a href="faq/installed.html" title="“Why is Python Installed on my Computer?” FAQ"
             >previous</a> |</li>
        <li><img src="_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="index.html">3.4.2 Documentation</a> &raquo;
        </li>
 
      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="copyright.html">Copyright</a> 1990-2014, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 08, 2014.
    <a href="bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.3.
    </div>

  </body>
</html>