General Python FAQ?Contents
General Information?What is Python??Python is an interpreted, interactive, object-oriented programming language. Itincorporates modules, exceptions, dynamic typing, very high level dynamic datatypes, and classes. Python combines remarkable power with very clear syntax.It has interfaces to many system calls and libraries, as well as to variouswindow systems, and is extensible in C or C++. It is also usable as anextension language for applications that need a programmable interface.Finally, Python is portable: it runs on many Unix variants, on the Mac, and onWindows 2000 and later. To find out more, start with The Python Tutorial. The Beginner’s Guide toPython links to otherintroductory tutorials and resources for learning Python. What is the Python Software Foundation??The Python Software Foundation is an independent non-profit organization thatholds the copyright on Python versions 2.1 and newer. The PSF’s mission is toadvance open source technology related to the Python programming language and topublicize the use of Python. The PSF’s home page is athttps://www./psf/. Donations to the PSF are tax-exempt in the US. If you use Python and find ithelpful, please contribute via the PSF donation page. Are there copyright restrictions on the use of Python??You can do anything you want with the source, as long as you leave thecopyrights in and display those copyrights in any documentation about Pythonthat you produce. If you honor the copyright rules, it’s OK to use Python forcommercial use, to sell copies of Python in source or binary form (modified orunmodified), or to sell products that incorporate Python in some form. We wouldstill like to know about all commercial use of Python, of course. See the PSF license page to find furtherexplanations and a link to the full text of the license. The Python logo is trademarked, and in certain cases permission is required touse it. Consult the Trademark Usage Policy for more information. Why was Python created in the first place??Here’s a very brief summary of what started it all, written by Guido vanRossum:
What is Python good for??Python is a high-level general-purpose programming language that can be appliedto many different classes of problems. The language comes with a large standard library that covers areas such asstring processing (regular expressions, Unicode, calculating differences betweenfiles), Internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP, CGIprogramming), software engineering (unit testing, logging, profiling, parsingPython code), and operating system interfaces (system calls, filesystems, TCP/IPsockets). Look at the table of contents for The Python Standard Library to get an ideaof what’s available. A wide variety of third-party extensions are alsoavailable. Consult the Python Package Index tofind packages of interest to you. How does the Python version numbering scheme work??Python versions are numbered A.B.C or A.B. A is the major version number – itis only incremented for really major changes in the language. B is the minorversion number, incremented for less earth-shattering changes. C is themicro-level – it is incremented for each bugfix release. See PEP 6 for moreinformation about bugfix releases. Not all releases are bugfix releases. In the run-up to a new major release, aseries of development releases are made, denoted as alpha, beta, or releasecandidate. Alphas are early releases in which interfaces aren’t yet finalized;it’s not unexpected to see an interface change between two alpha releases.Betas are more stable, preserving existing interfaces but possibly adding newmodules, and release candidates are frozen, making no changes except as neededto fix critical bugs. Alpha, beta and release candidate versions have an additional suffix. Thesuffix for an alpha version is “aN” for some small number N, the suffix for abeta version is “bN” for some small number N, and the suffix for a releasecandidate version is “cN” for some small number N. In other words, all versionslabeled 2.0aN precede the versions labeled 2.0bN, which precede versions labeled2.0cN, and those precede 2.0. You may also find version numbers with a “+” suffix, e.g. “2.2+”. These areunreleased versions, built directly from the CPython development repository. Inpractice, after a final minor release is made, the version is incremented to thenext minor version, which becomes the “a0” version, e.g. “2.4a0”. See also the documentation for How do I obtain a copy of the Python source??The latest Python source distribution is always available from , athttps://www./downloads/. The latest development sources can be obtainedat https://github.com/python/cpython/. The source distribution is a gzipped tar file containing the complete C source,Sphinx-formatted documentation, Python library modules, example programs, andseveral useful pieces of freely distributable software. The source will compileand run out of the box on most UNIX platforms. Consult the Getting Started section of the Python Developer’s Guide for moreinformation on getting the source code and compiling it. How do I get documentation on Python??The standard documentation for the current stable version of Python is availableat https://docs./3/. PDF, plain text, and downloadable HTML versions arealso available at https://docs./3/download.html. The documentation is written in reStructuredText and processed by the Sphinxdocumentation tool. The reStructuredText source forthe documentation is part of the Python source distribution. I’ve never programmed before. Is there a Python tutorial??There are numerous tutorials and books available. The standard documentationincludes The Python Tutorial. Consult the Beginner’s Guide tofind information for beginning Python programmers, including lists of tutorials. Is there a newsgroup or mailing list devoted to Python??There is a newsgroup, comp.lang.python, and a mailing list,python-list. Thenewsgroup and mailing list are gatewayed into each other – if you can read newsit’s unnecessary to subscribe to the mailing list.comp.lang.python is high-traffic, receiving hundreds of postingsevery day, and Usenet readers are often more able to cope with this volume. Announcements of new software releases and events can be found incomp.lang.python.announce, a low-traffic moderated list that receives about fivepostings per day. It’s available as the python-announce mailing list. More info about other mailing lists and newsgroupscan be found at https://www./community/lists/. How do I get a beta test version of Python??Alpha and beta releases are available from https://www./downloads/. Allreleases are announced on the comp.lang.python and comp.lang.python.announcenewsgroups and on the Python home page at https://www./; an RSS feed ofnews is available. You can also access the development version of Python through Git. SeeThe Python Developer’s Guide for details. How do I submit bug reports and patches for Python??To report a bug or submit a patch, please use the Roundup installation athttps://bugs./. You must have a Roundup account to report bugs; this makes it possible for us tocontact you if we have follow-up questions. It will also enable Roundup to sendyou updates as we act on your bug. If you had previously used SourceForge toreport bugs to Python, you can obtain your Roundup password through Roundup’spassword reset procedure. For more information on how Python is developed, consult the Python Developer’sGuide. Are there any published articles about Python that I can reference??It’s probably best to cite your favorite book about Python. The very first article about Python was written in 1991 and is now quiteoutdated.
Are there any books on Python??Yes, there are many, and more are being published. See the wiki athttps://wiki./moin/PythonBooks for a list. You can also search online bookstores for “Python” and filter out the MontyPython references; or perhaps search for “Python” and “l(fā)anguage”. Where in the world is www. located??The Python project’s infrastructure is located all over the world.www. is graciously hosted by Rackspace, with CDN caching provided by Fastly. Upfront Systems hosts bugs.. Many other Python services like the Wiki are hosted by Oregon StateUniversity Open Source Lab. Why is it called Python??When he began implementing Python, Guido van Rossum was also reading thepublished scripts from “Monty Python’s Flying Circus”, a BBC comedy series from the 1970s. Van Rossumthought he needed a name that was short, unique, and slightly mysterious, so hedecided to call the language Python. Do I have to like “Monty Python’s Flying Circus”??No, but it helps. :) Python in the real world?How stable is Python??Very stable. New, stable releases have been coming out roughly every 6 to 18months since 1991, and this seems likely to continue. Currently there areusually around 18 months between major releases. The developers issue “bugfix” releases of older versions, so the stability ofexisting releases gradually improves. Bugfix releases, indicated by a thirdcomponent of the version number (e.g. 2.5.3, 2.6.2), are managed for stability;only fixes for known problems are included in a bugfix release, and it’sguaranteed that interfaces will remain the same throughout a series of bugfixreleases. The latest stable releases can always be found on the Python download page. There are two recommended production-readyversions at this point in time, because at the moment there are two branches ofstable releases: 2.x and 3.x. Python 3.x may be less useful than 2.x, sincecurrently there is more third party software available for Python 2 than forPython 3. Python 2 code will generally not run unchanged in Python 3. How many people are using Python??There are probably tens of thousands of users, though it’s difficult to obtainan exact count. Python is available for free download, so there are no sales figures, and it’savailable from many different sites and packaged with many Linux distributions,so download statistics don’t tell the whole story either. The comp.lang.python newsgroup is very active, but not all Python users post tothe group or even read it. Have any significant projects been done in Python??See https://www./about/success for a list of projects that use Python.Consulting the proceedings for past Python conferences will reveal contributions from manydifferent companies and organizations. High-profile Python projects include the Mailman mailing list manager and the Zope application server. Several Linux distributions, most notably Red Hat, have written part or all of their installer andsystem administration software in Python. Companies that use Python internallyinclude Google, Yahoo, and Lucasfilm Ltd. What new developments are expected for Python in the future??See https://www./dev/peps/ for the Python Enhancement Proposals(PEPs). PEPs are design documents describing a suggested new feature for Python,providing a concise technical specification and a rationale. Look for a PEPtitled “Python X.Y Release Schedule”, where X.Y is a version that hasn’t beenpublicly released yet. New development is discussed on the python-dev mailing list. Is it reasonable to propose incompatible changes to Python??In general, no. There are already millions of lines of Python code around theworld, so any change in the language that invalidates more than a very smallfraction of existing programs has to be frowned upon. Even if you can provide aconversion program, there’s still the problem of updating all documentation;many books have been written about Python, and we don’t want to invalidate themall at a single stroke. Providing a gradual upgrade path is necessary if a feature has to be changed.PEP 5 describes the procedure followed for introducing backward-incompatiblechanges while minimizing disruption for users. Is Python a good language for beginning programmers??Yes. It is still common to start students with a procedural and statically typedlanguage such as Pascal, C, or a subset of C++ or Java. Students may be betterserved by learning Python as their first language. Python has a very simple andconsistent syntax and a large standard library and, most importantly, usingPython in a beginning programming course lets students concentrate on importantprogramming skills such as problem decomposition and data type design. WithPython, students can be quickly introduced to basic concepts such as loops andprocedures. They can probably even work with user-defined objects in their veryfirst course. For a student who has never programmed before, using a statically typed languageseems unnatural. It presents additional complexity that the student must masterand slows the pace of the course. The students are trying to learn to thinklike a computer, decompose problems, design consistent interfaces, andencapsulate data. While learning to use a statically typed language isimportant in the long term, it is not necessarily the best topic to address inthe students’ first programming course. Many other aspects of Python make it a good first language. Like Java, Pythonhas a large standard library so that students can be assigned programmingprojects very early in the course that do something. Assignments aren’trestricted to the standard four-function calculator and check balancingprograms. By using the standard library, students can gain the satisfaction ofworking on realistic applications as they learn the fundamentals of programming.Using the standard library also teaches students about code reuse. Third-partymodules such as PyGame are also helpful in extending the students’ reach. Python’s interactive interpreter enables students to test language featureswhile they’re programming. They can keep a window with the interpreter runningwhile they enter their program’s source in another window. If they can’tremember the methods for a list, they can do something like this: >>> >>> L = []>>> dir(L) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__','__dir__', '__doc__', '__eq__', '__format__', '__ge__','__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__','__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__','__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__','__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__','__sizeof__', '__str__', '__subclasshook__', 'append', 'clear','copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove','reverse', 'sort']>>> [d for d in dir(L) if '__' not in d]['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']>>> help(L.append)Help on built-in function append:append(...) L.append(object) -> None -- append object to end>>> L.append(1)>>> L[1] With the interpreter, documentation is never far from the student as they areprogramming. There are also good IDEs for Python. IDLE is a cross-platform IDE for Pythonthat is written in Python using Tkinter. PythonWin is a Windows-specific IDE.Emacs users will be happy to know that there is a very good Python mode forEmacs. All of these programming environments provide syntax highlighting,auto-indenting, and access to the interactive interpreter while coding. Consultthe Python wiki for a full listof Python editing environments. If you want to discuss Python’s use in education, you may be interested injoining the edu-sig mailing list. |
|