A year ago, if you asked an honest Python promoter, would python be missing something important like Perl and other languages? The answer is likely to be "yes". This is not to say that Python lacks a range of modules and package support (including Python itself and extension modules). This is certainly not a clear expression of Python's triumph and a concise object-oriented one.
Built on top of the Python community
What Python lacks is what the Perl developer describes as a "social factor". But even here, the lack of social factors does not mean the lack of a positive, intelligent and supportive Python community ―python has many of these communities. What python lacked a year ago was a fully planned infrastructure for sharing Python code. Code sharing is a specific, decentralized, and very mundane work.
The first step in improving the foundation of the Python Society may be the vaults of Parnassus site that Tim Middleton established (see Resources later in this article). For the first time, Python developers have a dedicated place where they have (almost) all the Third-party modules, packages, and tools available. But there are still some flaws in this place, making the site likely to be less advantageous than the comprehensive Perl Archive network (although the appearance is more beautiful than the latter), the vaults site simply points to the actual resource location and does not mirror the actual resource. The site is manually maintained by the Middleton, sometimes slowly updated, and vex.net (vaults site) has intermittent disconnection failures. In general, however, vaults of Parnassus provides valuable resources for building the architectural prerequisites for a powerful Python community.
With such a public site, all the Python community needs is to install all of these available modules, packages, and tools in a consistent, reliable way, and then use the same concise method to point out their role. Some of the new standard modules released by standard Python also provide a solution.
Pydoc
Ka-ping Yee has created a fairly famous module named Pydoc (in comparison: Pydoc can do anything perldoc can do, and do better and more beautiful:-). For Python 2.1来, Pydoc (and inspect that it supports) is part of the standard library. For users using the Python 1.5.2, 1.6 or 2.0 version, downloading and installing Pydoc is also easy-download now (see Resources).
As a background for any beginner who reads this python article, Python has a bit of a formal document standard. These standards do not attempt to unduly limit developers, but rather provide developers with "an obvious way to write documents." "Luckily, Python developers often write documents that are much better than typical developers who use other languages," he says.
The main reason why Python documents are "excellent" is to use so-called "docstring". Although DocString is actually just a variable called _DOC_, there is a commonly used shortcut to creating them: Simply put a simple string of (Sanchong) quotes around the head of a module, function Def, class definition, or method def. In addition, there are several near-standard module-level "Magic" variable names that are often used. Although those document rules are less formal, almost all third party modules and standard module documents use the same pattern. Let's look at a simplified example that uses most of the elements:
Listing 1: module with a typical document mymod.py
#!/usr/bin/python
"""Show off features of [pydoc] module
This is a silly module to
demonstrate docstrings
"""
__author__ = 'David Mertz'
__version__= '1.0'
__nonsense__ = 'jabberwocky'
class MyClass:
"""Demonstrate class docstrings"""
def __init__ (self, spam=1, eggs=2):
"""Set default attribute values only
Keyword arguments:
spam ― a processed meat product
eggs ― a fine breakfast for lumberjacks
"""
self.spam = spam
self.eggs = eggs