⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node17.html

📁 python的入门教程,讲得挺不错的,有一些实例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//CN"><html><head><link rel="STYLESHEET" href="style.css" type='text/css' /><link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /><link rel='start' href='../index.html' title='Python Documentation Index' /><link rel="first" href="tut.html" title='Python Tutorial' /><link rel='contents' href='node2.html' title="Contents" /><link rel='last' href='about.html' title='About this document...' /><link rel='help' href='about.html' title='About this document...' /><link rel="next" href="node18.html" /><link rel="prev" href="node16.html" /><link rel="parent" href="tut.html" /><link rel="next" href="node18.html" /><meta name='aesop' content='information' /><title>D. Glossary</title></head><body><DIV CLASS="navigation"><div id='top-navigation-panel' xml:id='top-navigation-panel'><table align="center" width="100%" cellpadding="0" cellspacing="2"><tr><td class='online-navigation'><a rel="prev" title="C. History and License"  href="node16.html"><img src='../icons/previous.png'  border='0' height='32'  alt='Previous Page' width='32' /></A></td><td class='online-navigation'><a rel="parent" title="Python Tutorial"  href="tut.html"><img src='../icons/up.png'  border='0' height='32'  alt='Up One Level' width='32' /></A></td><td class='online-navigation'><a rel="next" title="About this document ..."  href="node18.html"><img src='../icons/next.png'  border='0' height='32'  alt='Next Page' width='32' /></A></td><td align="center" width="100%" class='online-navigation'>Python Tutorial</td><td class='online-navigation'><a rel="contents" title="Table of Contents"  href="node2.html"><img src='../icons/contents.png'  border='0' height='32'  alt='Contents' width='32' /></A></td><td class='online-navigation'><img src='../icons/blank.png'  border='0' height='32'  alt='' width='32' /></td><td class='online-navigation'><img src='../icons/blank.png'  border='0' height='32'  alt='' width='32' /></td></tr></table><div class='online-navigation'><b class="navlabel">Previous:</b><a class="sectref" rel="prev" href="node16.html">C. History and License</A><b class="navlabel">Up:</b><a class="sectref" rel="parent" href="tut.html">Python Tutorial</A><b class="navlabel">Next:</b><a class="sectref" rel="next" href="node18.html">About this document ...</A></div><hr /></div></DIV><!--End of Navigation Panel--><H1><A NAME="SECTION0017000000000000000000"></A><A NAME="glossary"></A><BR>D. Glossary</H1><P><DL><DD><a id='l2h-53' xml:id='l2h-53'></a></DD><DT><STRONG><code>&gt;<code>&gt;</code>&gt;</code></STRONG></DT><DD>The typical Python prompt of the interactive shell.  Often seen forcode examples that can be tried right away in the interpreter.<P><a id='l2h-54' xml:id='l2h-54'></a></DD><DT><STRONG><code>.<code>.</code>.</code></STRONG></DT><DD>The typical Python prompt of the interactive shell when entering codefor an indented code block.<P><a id='l2h-55' xml:id='l2h-55'></a></DD><DT><STRONG>BDFL</STRONG></DT><DD>Benevolent Dictator For Life, a.k.a. <a class="ulink" href="http://www.python.org/~guido/"  >Guido vanRossum</a>, Python's creator.<P><a id='l2h-56' xml:id='l2h-56'></a></DD><DT><STRONG>byte code</STRONG></DT><DD>The internal representation of a Python program in the interpreter.The byte code is also cached in the <code>.pyc</code> and <code>.pyo</code>files so that executing the same file is faster the second time(compilation from source to byte code can be saved).  This``intermediate language'' is said to run on a ``virtualmachine'' that calls the subroutines corresponding to each bytecode.<P><a id='l2h-57' xml:id='l2h-57'></a></DD><DT><STRONG>classic class</STRONG></DT><DD>Any class which does not inherit from <tt class="class">object</tt>.  See<em>new-style class</em>.<P><a id='l2h-58' xml:id='l2h-58'></a></DD><DT><STRONG>coercion</STRONG></DT><DD><P>The implicit conversion of an instance of one type to another during anoperation which involves two arguments of the same type.  For example,<code>int(3.15)</code> converts the floating point number to the integer,<code>3</code>, but in <code>3+4.5</code>, each argument is of a different type (oneint, one float), and both must be converted to the same type before they canbe added or it will raise a <code>TypeError</code>.  Coercion between twooperands can be performed with the <code>coerce</code> builtin function; thus,<code>3+4.5</code> is equivalent to calling <code>operator.add(*coerce(3,4.5))</code> and results in <code>operator.add(3.0, 4.5)</code>.  Without coercion,all arguments of even compatible types would have to be normalized to thesame value by the programmer, e.g., <code>float(3)+4.5</code> rather than just<code>3+4.5</code>.<P><a id='l2h-59' xml:id='l2h-59'></a></DD><DT><STRONG>complex number</STRONG></DT><DD><P>An extension of the familiar real number system in which all numbers areexpressed as a sum of a real part and an imaginary part.  Imaginary numbersare real multiples of the imaginary unit (the square root of <code>-1</code>),often written <code>i</code> in mathematics or <code>j</code> in engineering.Python has builtin support for complex numbers, which are written with thislatter notation; the imaginary part is written with a <code>j</code> suffix,e.g., <code>3+1j</code>.  To get access to complex equivalents of the<tt class="module">math</tt> module, use <tt class="module">cmath</tt>.  Use of complex numbers is afairly advanced mathematical feature.  If you're not aware of a need for them,it's almost certain you can safely ignore them.<P><a id='l2h-60' xml:id='l2h-60'></a></DD><DT><STRONG>descriptor</STRONG></DT><DD>Any <em>new-style</em> object that defines the methods<tt class="method">__get__()</tt>, <tt class="method">__set__()</tt>, or <tt class="method">__delete__()</tt>.When a class attribute is a descriptor, its special binding behavioris triggered upon attribute lookup.  Normally, writing <var>a.b</var> looksup the object <var>b</var> in the class dictionary for <var>a</var>, but if<var>b</var> is a descriptor, the defined method gets called.Understanding descriptors is a key to a deep understanding of Pythonbecause they are the basis for many features including functions,methods, properties, class methods, static methods, and reference tosuper classes.<P><a id='l2h-61' xml:id='l2h-61'></a></DD><DT><STRONG>dictionary</STRONG></DT><DD>An associative array, where arbitrary keys are mapped to values.  Theuse of <tt class="class">dict</tt> much resembles that for <tt class="class">list</tt>, but the keyscan be any object with a <tt class="method">__hash__()</tt> function, not justintegers starting from zero.  Called a hash in Perl.<P><a id='l2h-62' xml:id='l2h-62'></a></DD><DT><STRONG>EAFP</STRONG></DT><DD>Easier to ask for forgiveness than permission.  This common Pythoncoding style assumes the existence of valid keys or attributes andcatches exceptions if the assumption proves false.  This clean andfast style is characterized by the presence of many <tt class="keyword">try</tt> and<tt class="keyword">except</tt> statements.  The technique contrasts with the<em>LBYL</em> style that is common in many other languages such as C.<P><a id='l2h-63' xml:id='l2h-63'></a></DD><DT><STRONG>__future__</STRONG></DT><DD>A pseudo module which programmers can use to enable new languagefeatures which are not compatible with the current interpreter.  Forexample, the expression <code>11/4</code> currently evaluates to <code>2</code>.If the module in which it is executed had enabled <em>true division</em>by executing:<P><div class="verbatim"><pre>from __future__ import division</pre></div><P>the expression <code>11/4</code> would evaluate to <code>2.75</code>.  By actuallyimporting the <a class="ulink" href="../lib/module-future.html"  ><tt class="module">__future__</tt></a>module and evaluating its variables, you can see when a new featurewas first added to the language and when it will become the default:<P><div class="verbatim"><pre>&gt;&gt;&gt; import __future__&gt;&gt;&gt; __future__.division_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)</pre></div><P><a id='l2h-64' xml:id='l2h-64'></a></DD><DT><STRONG>generator</STRONG></DT><DD>A function that returns an iterator.  It looks like a normal function exceptthat values are returned to the caller using a <tt class="keyword">yield</tt> statementinstead of a <tt class="keyword">return</tt> statement.  Generator functions oftencontain one or more <tt class="keyword">for</tt> or <tt class="keyword">while</tt> loops that<tt class="keyword">yield</tt> elements back to the caller.  The function execution isstopped at the <tt class="keyword">yield</tt> keyword (returning the result) and isresumed there when the next element is requested by calling the<tt class="method">next()</tt> method of the returned iterator.<P><a id='l2h-65' xml:id='l2h-65'></a></DD><DT><STRONG>generator expression</STRONG></DT><DD>An expression that returns a generator.  It looks like a normal expressionfollowed by a <tt class="keyword">for</tt> expression defining a loop variable, range, andan optional <tt class="keyword">if</tt> expression.  The combined expression generatesvalues for an enclosing function:<P><div class="verbatim"><pre>&gt;&gt;&gt; sum(i*i for i in range(10))         # sum of squares 0, 1, 4, ... 81285</pre></div><P><a id='l2h-66' xml:id='l2h-66'></a></DD><DT><STRONG>GIL</STRONG></DT><DD>See <em>global interpreter lock</em>.<P><a id='l2h-67' xml:id='l2h-67'></a></DD><DT><STRONG>global interpreter lock</STRONG></DT><DD>The lock used by Python threads to assure that only one thread can berun at a time.  This simplifies Python by assuring that no twoprocesses can access the same memory at the same time.  Locking theentire interpreter makes it easier for the interpreter to bemulti-threaded, at the expense of some parallelism on multi-processormachines.  Efforts have been made in the past to create a``free-threaded'' interpreter (one which locks shared data at a muchfiner granularity), but performance suffered in the commonsingle-processor case.<P><a id='l2h-68' xml:id='l2h-68'></a></DD><DT><STRONG>IDLE</STRONG></DT><DD>An Integrated Development Environment for Python.  IDLE is abasic editor and interpreter environment that ships with the standarddistribution of Python.  Good for beginners, it also serves as clearexample code for those wanting to implement a moderatelysophisticated, multi-platform GUI application.<P><a id='l2h-69' xml:id='l2h-69'></a></DD><DT><STRONG>immutable</STRONG></DT><DD>An object with fixed value.  Immutable objects are numbers, strings ortuples (and more).  Such an object cannot be altered.  A new objecthas to be created if a different value has to be stored.  They play an

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -