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

📄 15.html

📁 Python Ebook Python&XML
💻 HTML
字号:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Robots" content="INDEX,NOFOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE>Safari | Python Developer's Handbook -&gt; Main Technical Features</TITLE>
<LINK REL="stylesheet" HREF="oreillyi/oreillyN.css">
</HEAD>
<BODY bgcolor="white" text="black" link="#990000" vlink="#990000" alink="#990000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" cellpadding=5 cellspacing=0 border=0 class="navtopbg"><tr><td><font size="1"><p class="navtitle"><a href="8.html" class="navtitle">Web Development</a> &gt; <a href="0672319942.html" class="navtitle">Python Developer's Handbook</a> &gt; <a href="11.html" class="navtitle">1. Introduction</a> &gt; <span class="nonavtitle">Main Technical Features</span></p></font></td><td align="right" valign="top" nowrap><font size="1"><a href="main.asp?list" class="safnavoff">See All Titles</a></font></td></tr></table>
<TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="14.html" title="Why Use Python?"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=15" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="15.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="16.html" title="Python Distribution"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
<a href="5%2F31%2F2002+4%3A15%3A49+PM.html" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><font color=white size=1>152015024128143245168232148039199167010047123209178152124239215162145092168035203035224155</font><a href="read2.asp?bookname=0672319942&snode=15&now=5%2F31%2F2002+4%3A15%3A49+PM" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><br>
<FONT><h3>Main Technical Features</h3>
				<p>Now that you already know many reasons why you should use Python, let's focus on some of its main technical features.</p>

				<H4>Automatic Memory Management</H4>
					<P>Python objects are collected whenever they become unreachable. Python identifies the "garbage," taking the responsibility from you.</P>

				
				<h4>Exception Handling</h4>
					<p>The exception handling support helps you to catch errors without adding a lot of error checking statements to the code. By the way, it is said that Python programs never crash; they always return a <a NAME="idx1073741866"></a><a naME="idx1073741867"></A><Tt class="monofont">traceback</tt> message.</p>

				
				<h4>Rich Core Library</h4>
					<p>Many extension modules were already developed and became part of <a name="idx1073741868"></a><a nAme="idx1073741869"></A><i>The Standard Python Library</i> of tools, which can be used by programmers in any Python application. Besides those generic modules, we have others that are specific for particular platforms or environments. <i>The Standard Python Library</I> makes the tasks that are simple in theory also simple in practice.</p>

					<p>In a short time, programmers can make their Python programs speak to HTTP, FTP, SMTP, Telnet, POP, and many other services because Python modules perform all the common daily tasks. You can download a Web page, parse HTML files, show windows on the screen, and even use梐s part of your programs梑uilt-in interfaces that were created to handle many operational system services.<a nAme="idx1073741870"></a></P>

				
				<H4>Web Scripting Support and Data Handling</H4>
					<P>Python enables you to write CGI programs that work fine in several environments. Have you ever imagined switching platforms without changing the code? All right, it's possible if Python is the choice. There is even more: You can parse XML, HTML, SGML, and every other kind of text by using Python built-in classes and regular expression methods.</p>

				
				<h4>Built-In Elements</h4>
					<p>Python provides a huge list of useful built-in elements (the language's basic data structure) along with many special operations that are required to correctly process them. This list is as follows:</P>

					<UL>
<Li><p><a nAME="idx1073741871"></A>Data types梥uch as strings, tuples, lists, hash tables, and so on</p>
</li>
<lI><P><A Name="idx1073741872"></a>Operations條ike searching routine statements (in and not in), sorting, and so on</p>

						</li>
</ul>
				
				<h4>Development Flow</h4>
					<p>Even though it doesn't have any compilation or linking process, Python supports byte compilation. The compiled code is saved in an intermediate language called bytecode that can be accessed by any system that has a Python virtual machine. This feature offers a kind of portability similar to the one that Java also offers. Applications can be used in several different systems without the need for compilation. Furthermore, you can create a standalone executable and securely distribute your applications.</p>

				
				<h4>Clear Syntax and a Diversity of Useful Lexical Elements</h4>
					<p>The way Python is organized seems to encourage object-oriented programming because everything is an object. In addition to that, it has various helpful lexical elements, such as the following:</p>

					<ul>
<lI><p><a Name="idx1073741873"></A><a namE="idx1073741874"></a>Operator overloading桾he same operator has different meanings according to the elements that are being referenced.</p>
</lI>
<LI><P><a namE="idx1073741875"></A><A Name="idx1073741876"></a>Dynamic typing梇ou don't need to assign types in your code. After you assign a value to an object, it instantly knows what type it should assume. You can even assign different types to the same variable within the same program.<A NAMe="idx1073741877"></a></p>
</lI>
<LI><P><a name="idx1073741878"></a><a name="idx1073741879"></a>Name resolution桬ach structure (module, class, and so on) defines its own scope of names.</p>
</li>
<li><p><a nAme="idx1073741880"></A>Indentation桾here are no line-end markers as in Java and C++, where programmers need to use semicolons. Python defines indentations by using block structures.<a naMe="idx1073741881"></a><a nAme="idx1073741882"></a></P>

						</LI>
</Ul>
				
				<h4>Embeddable and Extendable</h4>
					<p>Python can be embedded in applications written in many other programming and scripting languages. Whenever you need to have a programmable interface for your applications, give Python a chance. Python is well known for easily gluing everything.</P>

					<P>Python also enables you to add low-level modules to the interpreter. Those built-in modules are easily written in C and C++. Extension modules are easily created and maintained using Python. For tasks like this, you can develop components in C and run them through Python subclasses.</P>

				
				<H4>Objects Distribution</h4>
					<p>Python can be used to implement routines that need to talk to objects in other applications. For example, Python is a great tool to glue Windows COM components. Besides that, Python also has a few CORBA implementations that enable you to use cross-platform distributed objects, as well.<a nAME="idx1073741883"></A><a namE="idx1073741884"></A></P>

				
				<H4>Databases</h4>
					<p>Python has interfaces to all major commercial databases, provides several facilities to handle flat-file databases, and implements object-persistence systems that can save entire objects to files. But the greatest database feature is that Python defines a standard database API, which makes it easy to port applications to different databases.</p>

				
				<h4>GUI Application</h4>
					<p>You can create applications that implement graphical user interfaces (GUIs), which are portable to many system calls, libraries, and windowing systems such as Windows MFC, Macintosh, Motif, and UNIX's X Window System. This is possible because many GUI bindings were developed for Python. The Python distribution is bundled with Tkinter, a standard object-oriented interface to the Tk GUI API that has become the official GUI development platform for Python.<a name="idx1073741885"></a></p>

				
				<h4>Introspection</h4>
					<p>You can develop programs in Python to help in the creation of other programs in Python. The most important examples are the Debugger and the Profiler. And there is even more: Python has an <a namE="idx1073741886"></a><a Name="idx1073741887"></A>Integrated Development Environment (IDLE) developed using Python for use with Python.</p>

				
				<h4>Third-Party Projects Integration</h4>
					<p>The Python Extension <A namE="idx1073741888"></A><A Name="idx1073741889"></a><I>NumPy (Numerical Extensions to Python)</I> along with the Python Library <A Name="idx1073741890"></a><A NAMe="idx1073741891"></a><a nAME="idx1073741892"></A><i>PIL (Python Imaging Library)</i> prove that everyone who contributes to the language can make his projects almost a required complement to the standard Python distribution.<a name="idx1073741893"></a></p>

				
			</font>
<P><TABLE width="100%" border=0><TR valign="top"><TD><font size=1 color="#C0C0C0"><br></font></TD><TD align=right><font size=1 color="#C0C0C0">Last updated on 1/30/2002<br>Python Developer's Handbook, &copy;&nbsp;2002 Sams Publishing</font></TD></TR></TABLE></P>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="14.html" title="Why Use Python?"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=15" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="15.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="16.html" title="Python Distribution"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
</TD></TR></TABLE>
<br><TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD><H4 class=Title>Index terms contained in this section</H4>
<font size=2>
data types<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073741871">Python</a><BR>
distribution<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objects<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073741884">Python</a><BR>
 <a href="#idx1073741875">dynamic typing</a><BR>
IDLE

⌨️ 快捷键说明

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