From Alex.Martelli@think3.com Fri Jun 1 11:29:01 2001 From: Alex.Martelli@think3.com (Alex Martelli) Date: Fri, 1 Jun 2001 12:29:01 +0200 Subject: [Doc-SIG] Re: Parameter passing in python Message-ID: <6D8A17398E28D3119F860090274DD7DBF135C4@pces.cadlab.it> "Jacob Hallen" wrote in message news:3B16C0C5.ABBBFA5C@hq.workspot.com... ... > However there is no mention at all of this in the Python Reference > Manual. I have checked both the 2.0 and 2.1 versions. It ought to > be in section 5.3.4, as far as I can understand. I think you're right, and the lack is still there in http://python.sourceforge.net/devel-docs/ref/calls.html I.e., it documents *args and **kwds for FORMAL parameters, but not the corresponding forms of ACTUAL parameters. I hope that CC'ing the doc-sig, as I've done, can do in lieu of filing a bugreport on sf.net (Fred, if you'd rather have me file a bugreport for this sort of things now and/or in the future, just let me know -- and thanks once again for the great job you've always been doing on the docs...!). Alex From fdrake@acm.org Fri Jun 1 15:33:37 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 1 Jun 2001 10:33:37 -0400 (EDT) Subject: [Doc-SIG] Re: Parameter passing in python In-Reply-To: <6D8A17398E28D3119F860090274DD7DBF135C4@pces.cadlab.it> References: <6D8A17398E28D3119F860090274DD7DBF135C4@pces.cadlab.it> Message-ID: <15127.42945.128258.112097@cj42289-a.reston1.va.home.com> "Jacob Hallen" wrote in message news:3B16C0C5.ABBBFA5C@hq.workspot.com... > However there is no mention at all of this in the Python Reference > Manual. I have checked both the 2.0 and 2.1 versions. It ought to > be in section 5.3.4, as far as I can understand. Alex Martelli writes: > I think you're right, and the lack is still there in > http://python.sourceforge.net/devel-docs/ref/calls.html > > I.e., it documents *args and **kwds for FORMAL parameters, > but not the corresponding forms of ACTUAL parameters. I > hope that CC'ing the doc-sig, as I've done, can do in lieu > of filing a bugreport on sf.net (Fred, if you'd rather > have me file a bugreport for this sort of things now and/or > in the future, just let me know -- and thanks once again Please do file a bug report on SF. Doc-SIG is a great place to discuss what should be in the docs, and how to explain things, but specific failings of the docs need to be filed on SF so we don't lose track of them. Thanks! -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From jeremy@digicool.com Fri Jun 1 21:01:54 2001 From: jeremy@digicool.com (Jeremy Hylton) Date: Fri, 1 Jun 2001 16:01:54 -0400 (EDT) Subject: [Doc-SIG] Re: [Types-sig] Re: documenting Python constraints on types In-Reply-To: <3B153436.EB8FAECE@arakne.com> References: <3B143FEB.F6FCC264@arakne.com> <15125.5480.380570.78206@cj42289-a.reston1.va.home.com> <3B153436.EB8FAECE@arakne.com> Message-ID: <15127.62642.866065.123897@slothrop.digicool.com> >>>>> "FG" == Frederic Giacometti writes: FG> "Fred L. Drake, Jr." wrote: >> I don't think that's quite it, though it certainly has an affect >> on the interest in documenting the types. Part of the lack of >> type information is a matter of there not being a shared set of >> names for abstract types that is also sufficient to be precise. >> (For example: What does it mean for an object to be a "mapping"? >> Perhaps has_key() is sufficient in one context, but get() and >> setdefault() are needed in another.) FG> A 'mapping' is an object that 'implements' the object protocol FG> (PyMapping_Check()... ok). I think that everybody's interessest FG> is in working for a small set of standard interface definitions. What's a sequence then? If you say anything that PySequence_Check() says okay for, then there is almost no code that accepts a sequence. In both cases, we would appear to skip instances that implement the sequence or mapping protocols, which are accepted most places that sequences or mappings are accepted. Jeremy From tim.one@home.com Fri Jun 1 21:11:31 2001 From: tim.one@home.com (Tim Peters) Date: Fri, 1 Jun 2001 16:11:31 -0400 Subject: [Doc-SIG] RE: [Types-sig] Re: documenting Python constraints on types In-Reply-To: <15127.62642.866065.123897@slothrop.digicool.com> Message-ID: [Jeremy Hylton] > What's a sequence then? If you say anything that PySequence_Check() > says okay for, then there is almost no code that accepts a sequence. ? Isn't that backwards? PySequence_Check() says "yes" to every instance, and in 2.2 even says "yes" to dictionaries too (because Guido filled in PyDict_Type's tp_as_sequence slot in order to get at sq_contains). From frederic.giacometti@arakne.com Sat Jun 2 13:03:28 2001 From: frederic.giacometti@arakne.com (Frederic Giacometti) Date: Sat, 02 Jun 2001 08:03:28 -0400 Subject: [Doc-SIG] Re: [Types-sig] Re: documenting Python constraints on types References: <3B143FEB.F6FCC264@arakne.com> <15125.5480.380570.78206@cj42289-a.reston1.va.home.com> <3B153436.EB8FAECE@arakne.com> <15127.62642.866065.123897@slothrop.digicool.com> Message-ID: <3B18D610.5AEBBB83@arakne.com> Jeremy Hylton wrote: > >>>>> "FG" == Frederic Giacometti writes: > > > FG> A 'mapping' is an object that 'implements' the object protocol > FG> (PyMapping_Check()... ok). I think that everybody's interessest > FG> is in working for a small set of standard interface definitions. > > What's a sequence then? If you say anything that PySequence_Check() > says okay for, then there is almost no code that accepts a sequence. > In both cases, we would appear to skip instances that implement the > sequence or mapping protocols, which are accepted most places that > sequences or mappings are accepted. OK. Taking the C check function as reference may not be the right thing (Then you might ask; Are the PySequence_Check and PyMapping_Check functions of any use other than checking that the the desiring protocol field has a non-null value in the C type defintion? ... but that's another debate). I guess some further definition and formalizing work is required for the basic Python types / protocol. Here is a step forward: In the same spirit as in the read-only / writable Mapping, you may define: - "Tuple" (as a non-mutable read-only sequence0 - "Vector" (items can be changed, but the sequence size is frozen, just like in a vector object) - List (anything can be done on it; modifying items, adding/removing items; just like a plain list). Here again, with these three hierarchical protocol/interfaces (each one add feature the previous did not have), you cover 98% of the sequence situations. FG From tim.one@home.com Sat Jun 2 23:30:17 2001 From: tim.one@home.com (Tim Peters) Date: Sat, 2 Jun 2001 18:30:17 -0400 Subject: [Doc-SIG] RE: [Types-sig] Re: documenting Python constraints on types In-Reply-To: <3B18D610.5AEBBB83@arakne.com> Message-ID: [Frederic Giacometti] > OK. Taking the C check function as reference may not be the right thing > (Then you might ask; Are the PySequence_Check and PyMapping_Check > functions of any use other than checking that the the desiring protocol > field has a non-null value in the C type defintion? No, they aren't. > ... but that's another debate). ? They do what they do. Whether that's useful depends on the purpose you have in mind. I'm sure Guido would prefer to drop the operator.isXXXType() functions, since they don't *usually* do what people "think" they do. But what people think they *ought* to do varies by person, so it's unclear how to improve the situation. > I guess some further definition and formalizing work is required > for the basic Python types / protocol. Have you looked at Paul Prescod's recent work here? Unfortunately, the Types-SIG home page doesn't seem to have a reference to it. Paul? > Here is a step forward: > In the same spirit as in the read-only / writable Mapping, you may > define: > > - "Tuple" (as a non-mutable read-only sequence Is that enough? Sometimes the distinction of interest is that it's-- unlike all tuples --immutable "all the way down". This is akin to the distinction the hash() builtin makes: not all tuples are hashable. This is a "shallow vs deep" thing, e.g. (1, 2, 3) vs (1, [2], 3). We *call* both of those "immutable" today, but the value of the latter (as seen by "==") may actually change over time. > - "Vector" (items can be changed, but the sequence size is > frozen, just like in a vector object) What's "a vector object" ? > - List (anything can be done on it; modifying items, adding/removing > items; just like a plain list). Including, e.g., list.sort()? You have to be very specific -- I'm afraid "just like" is never adequate, as different people read different things into any gap in precision. > Here again, with these three hierarchical protocol/interfaces > (each one add feature the previous did not have), you cover 98% of > the sequence situations. I would have guessed 97.9% . From dgoodger@bigfoot.com Sun Jun 3 15:30:08 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:30:08 -0400 Subject: [Doc-SIG] PEP: Docstring Processing System Framework Message-ID: Hello all, After much thought and reorganization*, I am pleased to offer this candidate PEP. Two related candidate PEPs follow, all part of the Docstring Processing System (DPS) project. I will be seeking PEP numbers ASAP; once obtained, I will post them to comp.lang.python. The website for this project is http://docstring.sf.net. The three PEPs posted here, plus supporting XML DTDs, are available for individual browsing there. I've released version 0.1 of the project, which contains all specification files as well as the code. Apart from one module (dps.statemachine, useful for line-based parsing using regular-expressions), there is only a skeleton of the core system. I welcome any input. Several similar projects already exist. I invite their authors to take a look at the approach presented in this PEP and to consider consolidating our efforts. I will be happy to add developers and project admins to the SourceForge project; please let me know if you are interested. I would like this to be an open, community project! I've simultaneously released the reStructuredText project, an input parser component for the DPS, at http://structuredtext.sf.net. I'll be posting the updated specification to Doc-SIG shortly. My hope is that these projects will form the foundation for a standard documentation tool for Python. * See the "History" section of http://structuredtext.sf.net/spec/introduction.txt. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net -----%<----------cut----------%<----------%<----------cut----------%<----- PEP: ??? Title: Docstring Processing System Framework Version: $Revision$ Author: dgoodger@bigfoot.com (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track Requires: (Docstring Conventions PEP), (DPS Generic Implementation Details PEP) Created: 01-Jun-2001 Post-History: Abstract Python modules, classes and functions have a string attribute called __doc__. If the first expression inside the definition is a literal string, that string is assigned to the __doc__ attribute, called a documentation string or docstring. It is often used to summarize the interface of the module, class or function. There is no standard format (markup) for docstrings, nor are there standard tools for extracting docstrings and transforming them into useful structured formats (e.g., HTML, DocBook, TeX). Those tools that do exist are for the most part unmaintained and unused. The issues surrounding docstring processing have been contentious and difficult to resolve. This PEP proposes a Docstring Processing System (DPS) framework. It separates out the components (program and conceptual), enabling the resolution of individual issues either through consensus (one solution) or through divergence (many). It promotes standard interfaces which will allow a variety of plug-in components (e.g., input parsers and output formatters) to be used. This PEP presents the concepts of a DPS framework independently of implementation details. Copyright This document has been placed in the public domain. Acknowledgements This document borrows text from PEP 216 "Docstring Format" by Moshe Zadka [1]. It is intended as a reorganization of PEP 216 and its approach. This document also borrows ideas from the archives of the Python Doc-SIG. Thanks to all members past & present. Project Website A SourceForge project has been set up for this work at http://docstring.sf.net. Rationale Python lends itself to inline documentation. With its built-in docstring syntax, a limited form of Literate Programming [2] is easy to do in Python. However, there are no satisfactory standard tools for extracting and processing Python docstrings. The lack of a standard toolset is a significant gap in Python's infrastructure; this PEP aims to fill the gap. There are standard inline documentation systems for some other languages. For example, Perl has POD (plain old documentation) and Java has Javadoc, but neither of these mesh with the Pythonic way. POD is very explicit, but takes after Perl in terms of readability. Javadoc is HTML-centric; except for '@field' tags, raw HTML is used for markup. There are also general tools such as Autoduck and Web (Tangle & Weave), useful for multiple languages. There have been many attempts to write autodocumentation systems for Python (not an exhaustive list): - Marc-Andre Lemburg's doc.py [3] - Daniel Larsson's pythondoc & gendoc [4] - Doug Hellmann's HappyDoc [5] - Laurence Tratt's Crystal [6] - Ka-Ping Yee's htmldoc & pydoc [7] (pydoc.py is now part of the Python standard library; see below) - Tony Ibbs' docutils [8] These systems, each with different goals, have had varying degrees of success. A problem with many of the above systems was overambition. They provided a self-contained set of components: a docstring extraction system, an input parser, an internal processing system and one or more output formatters. Inevitably, one or more components had serious shortcomings, preventing the system from being adopted as a standard tool. Throughout the existence of the Python Documentation Special Interest Group (Doc-SIG) [9], consensus on a single standard docstring format has never been reached. A lightweight, implicit markup has been sought, for the following reasons (among others): 1. Docstrings written within Python code are available from within the interactive interpreter, and can be 'print'ed. Thus the use of plaintext for easy readability. 2. Programmers want to add structure to their docstrings, without sacrificing raw docstring readability. Unadorned plaintext cannot be transformed ('up-translated') into useful structured formats. 3. Explicit markup (like XML or TeX) has been widely considered unreadable by the uninitiated. 4. Implicit markup is aesthetically compatibile with the clean and minimalist Python syntax. Early on, variants of Setext (Structure Enhanced Text) [10], including Digital Creation's StructuredText [11], were proposed for Python docstring formatting. Hereafter we will collectively call these variants 'STexts'. Although used by some (including in most of the above-listed autodocumentation tools), these markup schemes have failed to become standard because: - STexts have been incomplete: lacking 'essential' constructs that people want to use in their docstrings, STexts are rendered less than ideal. Note that these 'essential' constructs are not universal; everyone has their own requirements. - STexts have been sometimes surprising: bits of text are marked up unexpectedly, leading to user frustration. - SText implementations have been buggy. - Some STexts have have had no formal specification except for the implementation itself. A buggy implementation meant a buggy spec, and vice-versa. - There has been no mechanism to get around the SText markup rules when a markup character is used in a non-markup context. Recognizing the deficiencies of STexts, some people have proposed using explicit markup of some kind. There have been proposals for using XML, HTML, TeX, POD, and Javadoc at one time or another. Proponents of STexts have vigorously opposed these proposals, and the debates have continued off and on for at least five years. It has become clear (to this author, at least) that the "all or nothing" approach cannot succeed, since no all-encompassing proposal could possibly be agreed upon by all interested parties. A modular component approach, where components may be multiply implemented, is the only chance at success. By separating out the issues, we can form consensus more easily (smaller fights ;-), and accept divergence more readily. Each of the components of a docstring processing system should be developed independently. A 'best of breed' system should be chosen and/or developed and eventually included in Python's standard library. Pydoc & Other Existing Systems Pydoc is part of the Python 2.1 standard library. It extracts and displays docstrings from within the Python interactive interpreter, from the shell command line, and from a GUI window into a web browser (HTML). In the case of GUI/HTML, except for some heuristic hyperlinking of identifier names, no formatting of the docstrings is done. They are presented within

tags to avoid unwanted line wrapping. Unfortunately, the result is not pretty. The functionality proposed in this PEP could be added to or used by pydoc when serving HTML pages. However, the proposed docstring processing system's functionality is much more than pydoc needs (in its current form). Either an independent tool will be developed (which pydoc may or may not use), or pydoc could be expanded to encompass this functionality and *become* the docstring processing system (or one such system). That decision is beyond the scope of this PEP. Similarly for other existing docstring processing systems, their authors may or may not choose compatibility with this framework. However, if this framework is accepted and adopted as the Python standard, compatibility will become an important consideration in these systems' future. Specification The docstring processing system framework consists of components, as follows:: 1. Docstring conventions. Documents issues such as: - What should be documented where. - First line is a one-line synopsis. 2. Docstring processing system generic implementation details. Documents issues such as: - High-level spec: what a DPS does. - Command-line interface for executable script. - System Python API - Docsring extraction rules. - Input parser API. - Intermediate internal data structure: output from input parser, input to output formatter. - Output formatter API. - Output management. These issues are applicable to any docstring processing system implementation. 3. Docstring processing system implementation. 4. Input markup specificiations: docstring syntax. 5. Input parser implementations. 6. Output formats (HTML, XML, TeX, DocBook, info, etc.). 7. Output formatter implementations. Components 1, 2, and 3 will be the subject of individual companion PEPs, although they may be merged into this PEP once consensus is reached. If there is only one implementation, PEPs for components 2 & 3 can be combined. Multiple PEPs will be necessary for each of components 4, 5, 6, and 7. An alternative to the PEP mechanism may be used instead, since these are not directly related to the Python language. The following diagram shows an overview of the framework (very wide-- apologies for line wrapping; interfaces are indicated by double-borders):: +========================+ | Command-Line Interface | +========================+ | Executable Script | +------------------------+ | v +===========================================+ returns +---------+ | System Python API |==========>| output | +--------+ +===========================================+ | objects | _ writes | Python | reads | Docstring Processing System | +---------+ / \ ==============>| module |<===========| | \_/ +--------+ | input | transformation, | output | +--------+ | +-------------+ follows | docstring | integration, | object | writes | output | --+-- consults | docsring |<-----------| extraction | linking | management |===========>| files | | --------->| conventions | +============+=====+=====+=====+============+ +--------+ / \ +-------------+ | parser API | | formatter API | / \ +-------------+ +===========+======+ +======+===========+ +--------+ author consults | markup | implements | input | intermediate | output | implements | output | --------->| syntax spec |<-----------| parser | data structure | formatter |----------->| format | +-------------+ +-----------+-------------------+-----------+ +--------+ References and Footnotes [1] http://python.sf.net/peps/pep-0216.html [2] http://www.literateprogramming.com/ [3] http://www.lemburg.com/files/python/SoftwareDescriptions.html#doc.py [4] http://starship.python.net/crew/danilo/pythondoc/ [5] http://happydoc.sf.net/ [6] http://www.btinternet.com/~tratt/comp/python/crystal/index.html [7] http://www.lfw.org/python/ [8] http://homepage.ntlworld.com/tibsnjoan/docutils/ [9] http://www.python.org/sigs/doc-sig/ [10] http://www.bsdi.com/setext/ [11] http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage/ Local Variables: mode: indented-text indent-tabs-mode: nil End: From dgoodger@bigfoot.com Sun Jun 3 15:32:21 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:32:21 -0400 Subject: [Doc-SIG] PEP: DPS Generic Implementation Details Message-ID: PEP: ??? Title: DPS Generic Implementation Details Version: $Revision$ Author: dgoodger@bigfoot.com (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Standards Track Created: 31-May-2001 Post-History: Abstract This PEP documents generic implementation details for a Python Docstring Processing System (DPS). Copyright This document has been placed in the public domain. Acknowledgements This document borrows ideas from the archives of the Python Doc-SIG [1]. Thanks to all members past & present. Project Website A SourceForge project has been set up for this work at http://docstring.sf.net. Specification Docstring Extraction Rules ========================== 1. If the '__all__' variable is present in the module being documented, only identifiers listed in '__all__' are examined for docstrings. In the absense of '__all__', all identifiers are examined, except those whose names are private (names begin with '_' but don't begin and end with '__'). 2. Docstrings are string literal expressions, and are recognized in the following places within Python modules: a) At the beginning of a module, class definition, or function definition, after any comments. This is the standard for Python __doc__ attributes. b) Immediately following a simple assignment at the top level of a module, class definition, or __init__ method definition, after any comments. See "Attribute Docstrings" below. c) Additional string literals found immediately after the docstrings in (a) and (b) will be recognized, extracted, and concatenated. See "Additional Docstrings" below. 3. Python modules must be parsed by the docstring processing system, not imported. There are security reasons for not importing untrusted code. Also, docstrings are to be recognized in places where the bytecode compiler ignores string literal expressions (2b and 2c above), meaning importing the module will lose these docstrings. Of course, standard Python parsing tools such as the 'parser' library module should be used. Since attribute docstrings and additional docstrings are not recognized by the Python bytecode compiler, no namespace pollution or performance degradation will result from their use. (The initial parsing of a module may take a slight performance hit.) Attribute Docstrings -------------------- XXX A description of attribute docstrings would be appropriate in the Docstring Conventions PEP. (This is a simplified version of PEP 224 [2] by Marc-Andre Lemberg.) A string literal immediately following an assignment statement is interpreted by the docstring extration machinery as the docstring of the target of the assignment statement, under the following conditions: 1. The assignment must be in one of the following contexts: a) At the top level of a module (i.e., not inside a loop or conditional): a module attribute. b) At the top level of a class definition: a class attribute. c) At the top level of a class' '__init__' method definition: an instance attribute. Since each of the above contexts are at the top level (i.e., just inside the outermost suite of a definition), it may be necessary to place dummy assignments for attributes assigned conditionally or in a loop. Blank lines may be used after attribute docstrings to emphasize the connection between the assignment and the docstring. 2. The assignment must be to a single target, not to a list or a tuple of targets. 3. The form of the target: a) For contexts 1a and 1b above, the target must be a simple identifier (not a dotted identifier, a subscripted expression, or a sliced expression). b) For context 1c above, the target must be of the form 'self.attrib', where 'self' matches the '__init__' method's first parameter (the instance parameter) and 'attrib' is a simple indentifier as in 3a. Examples:: g = 'module attribute (global variable)' """This is g's docstring.""" class AClass: c = 'class attribute' """This is AClass.c's docstring.""" def __init__(self): self.i = 'instance attribute' """This is self.i's docstring.""" Additional Docstrings --------------------- XXX A description of additional docstrings would be appropriate in the Docstring Conventions PEP. Many programmers would like to make extensive use of docstrings for API documentation. However, docstrings do take up space in the running program, so some of these programmers are reluctant to 'bloat up' their code. Also, not all API documentation is applicable to interactive environments, where __doc__ would be displayed. The docstring processing system's extraction tools will concatenate all string literal expressions which appear at the beginning of a definition or after a simple assignment. Only the first strings in definitions will be available as __doc__, and can be used for brief usage text suitable for interactive sessions; subsequent string literals and all attribute docstrings are ignored by the Python bytecode compiler and may contain more extensive API information. Example:: def function(arg): """This is __doc__, function's docstring.""" """ This is an additional docstring, ignored by the bytecode compiler, but extracted by the docstring processing system. """ pass Issue: This breaks 'from __future__ import' statements in Python 2.1 for multiple module docstrings. Resolution? 1. Should we search for docstrings after a __future__ statement? Very ugly. 2. Redefine __future__ statements to allow multiple preceeding string literals? 3. Or should we not even worry about this? There shouldn't be __future__ statements in production code, after all. Modules with __future__ statements will have to put up with the single-docstring limitation. Choice of Docstring Format ========================== Rather than force everyone to use a single docstring format, multiple input formats are allowed by the processing system. A special variable, __docformat__, may appear at the top level of a module before any function or class definitions. Over time or through decree, a standard format or set of formats should emerge. The __docformat__ variable is a string containing the name of the format being used, a case-insensitive string matching the input parser's module or package name (i.e., the same name as required to 'import' the module or package), or a registered alias. If no __docformat__ is specified, the default format is 'plaintext' for now; this may be changed to the standard format once determined. The __docformat__ string may contain an optional second field, separated from the format name (first field) by a single space: a case-insensitive language identifier as defined in RFC 1766 [3]. A typical language identifier consists of a 2-letter language code from ISO 639 [4] (3-letter codes used only if no 2-letter code exists; RFC 1766 is currently being revised to allow 3-letter codes). If no language identifier is specified, the default is 'en' for English. The language identifier is passed to the parser and can be used for language-dependent markup features. DPS Structure ============= - package 'dps' - function 'dps.main()' (in 'dps/__init__.py') - package 'dps.parsers' - module 'dps.parsers.model'; see 'Input Parser API' below. - package 'dps.formatters' - module 'dps.formatters.model'; see 'Output Formatter API' below. - package 'dps.languages' - module 'dps.languages.en' (English) - others to be added - utility modules: 'dps.statemachine' Command-Line Interface ====================== XXX To be determined. System Python API ================= XXX To be determined. Input Parser API ================ Each input parser is a module or package exporting a 'Parser' class, with the following interface: class Parser: def __init__(self, inputstring, errors='warn', language='en'): """Initialize the Parser instance.""" def parse(self): """Return a DOM tree, the parsed input string.""" XXX This needs a lot of work. What is required for this API? A model 'Parser' class implementing the full interface along with utility functions can be found in the 'dps.parsers.model' module. Output Formatter API ==================== Each output formatter is a module or package exporting a 'Formatter' class, with the following interface: class Formatter: def __init__(self, domtree, language='en', showwarnings=0): """Initialize the Formatter instance.""" def format(self): """ Return a formatted string representation of the DOM tree. """ XXX This also needs a lot of work. What is required for this API? A model 'Formatter' class implementing the full interface along with utility functions can be found in the 'dps.formatters.model' module. Language Module API =================== Language modules will contain language-dependent strings and mappings. They will be named for their language identifier (as defined in 'Choice of Docstring Format' above), converting dashes to underscores. XXX Specifics to be determined. Intermediate Data Structure =========================== A single intermediate data structure is used internally by the docstring processing system. This data structure is a DOM tree whose schema is documented in an XML DTD (eXtensible Markup Language Document Type Definition), which comes in three parts: - the Python Plaintext Document Interface DTD, ppdi.dtd [5], - the Generic Plaintext Document Interface DTD, gpdi.dtd [6], - and the OASIS Exchange Table Model, soextbl.dtd [7]. The DTD defines a rich set of elements, suitable for any input syntax or output format. The input parser and the output formatter share the same intermediate data structure. The processing system may do transformations on the data from the input parser before passing it on to the output formatter. The DTD retains all information necessary to reconstruct the original input text, or a reasonable facsimile thereof. XXX Specifics (about the DOM tree) to be determined. Output Management ================= XXX To be determined. Type of output: filesystem only, or in-memory data structure too? File/directory naming & structure conventions. In-memory data structure should follow filesystem naming; file/directory == leaf/node. Use a directory hierarchy rather than long file names (long file names were one of the reasons pythondoc couldn't run on MacOS). References and Footnotes [1] http://www.python.org/sigs/doc-sig/ [2] http://python.sf.net/peps/pep-0224.html [3] http://www.rfc-editor.org/rfc/rfc1766.txt [4] http://lcweb.loc.gov/standards/iso639-2/englangn.html [5] http://docstring.sf.net/spec/ppdi.dtd [6] http://docstring.sf.net/spec/ppdi.dtd [7] http://docstring.sf.net/spec/soextblx.dtd Local Variables: mode: indented-text indent-tabs-mode: nil End: From dgoodger@bigfoot.com Sun Jun 3 15:32:49 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:32:49 -0400 Subject: [Doc-SIG] PEP: Docstring Conventions Message-ID: PEP: ??? Title: Docstring Conventions Version: $Revision$ Author: dgoodger@bigfoot.com (David Goodger) Discussions-To: doc-sig@python.org Status: Draft Type: Informational Created: 29-May-2001 Post-History: Abstract This PEP documents the semantics and conventions associated with Python docstrings. Copyright This document has been placed in the public domain. Acknowledgements The "Specificaton" text comes mostly verbatim from the Python Style Guilde by Guido van Rossum [1]. (If it's OK with him, I will add GvR as an author of this PEP. I am quite confident that the BDFL doesn't want to own this PEP :-). Apart from minor editing, proposed additions to the Style Guide text are marked with '[+]' to the left of each line, and proposed omissions are marked with '[-]'. If it is deemed that this PEP is unnecessary, then it can be taken as suggestions for Style Guide modification.) This document borrows ideas from the archives of the Python Doc-SIG [2]. Thanks to all members past & present. Specification All modules should normally have docstrings, and all functions and classes exported by a module should also have docstrings. Public methods (including the __init__ constructor) should also have doc strings. [+] A package may be documented in the module docstring of the [+] __init__.py file in the package directory. The docstring of a script (a stand-alone program) should be usable as its "usage" message, printed when the script is invoked with incorrect or missing arguments (or perhaps with a "-h" option, for "help"). Such a docstring should document the script's function and command line syntax, environment variables, and files. Usage messages can be fairly elaborate (several screenfuls) and should be sufficient for a new user to use the command properly, as well as a complete quick reference to all options and arguments for the sophisticated user. For consistency, always use """triple double quotes""" around doc strings. [+] Use r"""raw triple double quotes""" if you use any [+] backslashes in your docstrings. There are two forms of docstrings: one-liners and multi-line docstrings. One-line Docstrings -------------------- One-liners are for really obvious cases. They should really fit on one line. For example: def kos_root(): """Return the pathname of the KOS root directory.""" global _kos_root if _kos_root: return _kos_root ... Notes: - Triple quotes are used even though the string fits on one line. This makes it easy to later expand it. - The closing quotes are on the same line as the opening quotes. This looks better for one-liners. - There's no blank line either before or after the docstring. - The docstring is a phrase ending in a period. It prescribes the function's effect as a command ("Do this", "Return that"), not as a description: e.g. don't write "Returns the pathname ..." [+] - The one-line docstring should NOT be a "signature" reiterating [+] the function parameters (which can be obtained by introspection). [+] Don't do: [+] def function(a, b): [+] """function(a, b) -> list""" [+] This type of docstring is only appropriate for C functions (such [+] as built-ins), where introspection is not possible. Multi-line Docstrings ---------------------- Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description. The summary line may be used by automatic indexing tools; it is important that it fits on one line and is separated from the rest of the docstring by a blank line. The entire docstring is indented the same as the quotes at its first line (see example below). Docstring processing tools will strip an amount of indentation from the second and further lines of the docstring equal to the indentation of the first non-blank line after the first line of the docstring. Relative indentation of later lines in the docstring is retained. Insert a blank line before and after all docstrings (one-line or multi-line) that document a class -- generally speaking, the class' methods are separated from each other by a single blank line, and the docstring needs to be offset from the first method by a blank line; for symmetry, put a blank line between the class header and the docstring. Docstrings documenting functions generally don't have this requirement, unless the function's body is written as a number of blank-line separated sections -- in this case, treat the docstring as another section, and precede it with a blank line. The docstring for a module should generally list the classes, exceptions and functions (and any other objects) that are exported by the module, with a one-line summary of each. (These summaries generally give less detail than the summary line in the object's docstring.) The docstring for a function or method should summarize its behavior and document its arguments, return value(s), side effects, exceptions raised, and restrictions on when it can be called (all if applicable). Optional arguments should be indicated. It should be documented whether keyword arguments are part of the interface. The docstring for a class should summarize its behavior and list the public methods and instance variables. If the class is intended to be subclassed, and has an additional interface for subclasses, this interface should be listed separately (in the docstring). The class constructor should be documented in the docstring for its __init__ method. Individual methods should be documented by their own docstring. If a class subclasses another class and its behavior is mostly inherited from that class, its docstring should mention this and summarize the differences. Use the verb "override" to indicate that a subclass method replaces a superclass method and does not call the superclass method; use the verb "extend" to indicate that a subclass method calls the superclass method (in addition to its own behavior). *Do not* use the Emacs convention of mentioning the arguments of functions or methods in upper case in running text. Python is case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument names. It is best to list each argument on a separate line, [-] with two dashes separating the name from the description, like this: def complex(real=0.0, imag=0.0): """Form a complex number. Keyword arguments: real -- the real part (default 0.0) imag -- the imaginary part (default 0.0) """ if imag == 0.0 and real == 0.0: return complex_zero ... [-] The BDFL [3] recommends inserting a blank line between the [-] last paragraph in a multi-line doc string and its closing quotes, [-] placing the closing quotes on a line by themselves. This way, [-] Emacs' fill-paragraph command can be used on it. [+] Attribute Docstrings: see DPS Generic Implementation Details PEP [+] Additional Docstrings: see DPS Generic Implementation Details PEP References and Footnotes [1] http://www.python.org/doc/essays/styleguide.html [2] http://www.python.org/sigs/doc-sig/ [3] Guido van Rossum, Python's Benevolent Dictator For Life. Local Variables: mode: indented-text indent-tabs-mode: nil End: From dgoodger@bigfoot.com Sun Jun 3 15:33:54 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:33:54 -0400 Subject: [Doc-SIG] An Introduction to reStructuredText Message-ID: ===================================== An Introduction to reStructuredText ===================================== Author: David Goodger Contact: dgoodger@bigfoot.com Status: second draft Date: 2001-06-02 reStructuredText_ is a proposed revision and reinterpretation of the StructuredText_ and Setext_ lightweight markup systems. reStructuredText is useful for quickly creating simple web pages and for in-line program documentation (in comments of any programming language, or in documentation strings of languages such as Python and Emacs Lisp). It can be used in systems which extract in-line comments and docstrings to create API documentation. reStructuredText is designed for extensibility for specific application domains. It is a candidate markup syntax for the `Python Docstring Processing System`_. This document defines the goals_ of reStructuredText, provides a history_ of the project, and outlines a `parser implementation plan`_. It is also written with the reStructuredText markup, therefore serves as an example of its use. Please also see an analysis of the problems of StructuredText, and the reStructuredText markup specification itself (general and Python extensions), all on the project's web site, http://structuredtext.sf.net/. .. _reStructuredText: http://structuredtext.sf.net .. _StructuredText: http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage .. _Setext: http://www.bsdi.com/setext .. _Python Docstring Processing System: http://docstring.sf.net .. _goals: Goals ===== The primary goal of reStructuredText_ is to define a markup syntax for use in Python docstrings and other documentation domains, that is readable and simple, yet powerful enough for non-trivial use. The intended purpose of the markup is the conversion of reStructuredText documents into useful structured data formats. The secondary goal of reStructuredText is to be accepted by the Python community (by way of being blessed by PythonLabs and the BDFL [1]_) as a standard for Python inline documentation (possibly one of several standards, to account for taste). .. _[1] Python's creator and "Benevolent Dictator For Life", Guido van Rossum. To clarify the primary goal, here are specific design goals, in order, beginning with the most important: 1. Readable: The marked-up text must be easy to read without any prior knowledge of the markup language. It should be as easily read in raw form as in processed form. 2. Unobtrusive: The markup that is used should be as simple and unobtrusive as possible. The simplicity of markup constructs should be roughly proporional to their frequency of use. 3. Unambiguous: The rules for markup must not be open for interpretation. For any given input, there should be one and only one possible output (including error output). 4. Unsurprising: Markup constructs should not cause unexpected output upon processing. As a fallback, there must be a way to prevent unwanted markup processing when a markup construct is used in a non-markup context (for example, when documenting the markup syntax itself). 5. Intuitive: Markup should be as obvious and easily remembered as possible, for the author as well as for the reader. Constructs should take their cues from such naturally occurring sources as plaintext email messages and newsgroup postings. 6. Easy: It should be easy to mark up text using any ordinary text editor. 7. Scalable: The markup should be applicable regardless of the length of the text. 8. Powerful: The markup should provide enough constructs to produce a reasonably rich structured document. 9. Language-neutral: The markup should apply to multiple natural (as well as artificial) languages, not only English. 10. Extensible: The markup should provide a simple syntax and interface for adding more complex general markup, and custom markup. 11. Output-format-neutral: The markup will be appropriate for processing to multiple output formats, and will not be biased toward any particular format. The design goals above were used as criteria for accepting or rejecting syntax, or selecting between alternatives. It is emphatically *not* the goal of reStructuredText to define docstring semantics, such as docstring contents or docstring length. These issues are orthogonal to the markup syntax and beyond the scope of this proposal. Also, it is not the goal of reStructuredText to maintain compatibility with StructuredText_ or Setext_. reStructuredText shamelessly steals their great ideas and ignores the not-so-great. Author's note: Due to the nature of the problem we're trying to solve (or, perhaps, due to the nature of the proposed solution), the above goals unavoidably conflict. I have tried to extract and distill the wisdom accumulated over the years in the Python Doc-SIG_ mailing list and elsewhere, to come up with a coherent and consistent set of syntax rules, and the above goals by which to measure them. There will inevitably be people who disagree with my particular choices. Some desire finer control over their markup, others prefer less. Some are concerned with very short docstrings, others with full-length documents. This specification is an effort to provide a reasonably rich set of markup constructs in a reasonably simple form, that should satisfy a reasonably large group of reasonable people. David Goodger (dgoodger@bigfoot.com), 2001-04-20 .. _Doc-SIG: http://www.python.org/sigs/doc-sig/ .. _history: History ======= reStructuredText_, the specification, is based on StructuredText_ and Setext_. StructuredText was developed by Jim Fulton of `Digital Creations`_ and first released in 1996. It is now released as a part of the open-source 'Z Object Publishing Environment' (ZOPE_). Ian Feldman's and Tony Sanders' earlier Setext_ specification was either an influence on StructuredText or, by their similarities, at least evidence of the correctness of this approach. I discovered StructuredText_ in late 1999 while searching for a way to document the Python modules in one of my projects. Version 1.1 of StructuredText was included in Daniel Larsson's pythondoc_. Although I was not able to get pythondoc to work for me, I found StructuredText to be almost ideal for my needs. I joined the Python Doc-SIG_ (Documentation Special Interest Group) mailing list and found an ongoing discussion of the shortcomings of the StructuredText 'standard'. This discussion has been going on since 1996. I decided to modify the original module with my own extensions and some suggested by the Doc-SIG members. I soon realized that the module was not written with extension in mind, so I embarked upon a general reworking, including adapting it to the 're' regular expression module (the original inspiration for the name of this project). Soon after I completed the modifications, I discovered that StructuredText.py was up to version 1.23 in the ZOPE distribution. Implementing the new syntax extensions from version 1.23 proved to be an exercise in frustration, as the complexity of the module had become overwhelming. Recently, development on StructuredTextNG_ ("Next Generation") has begun at Digital Creations. It seems to have many improvements, but still suffers from many of the problems of classic StructuredText. I decided that a complete rewrite was in order, and even started a SourceForge project, reStructuredText_. My motivations (the 'itches' I aim to 'scratch') are as follows: - I need a standard format for inline documentation of the programs I write. This inline documentation has to be convertible to other useful formats, such as HTML. I believe many others have the same need. - I believe in the Setext/StructuredText idea and want to help formalize the standard. However, I feel the current specifications and implementations have flaws that desperately need fixing. - reStructuredText could form part of the foundation for a documentation extraction and processing system, greatly benefitting Python. But it is only a part, not the whole. reStructuredText is a markup language specification and (soon to be) a reference parser implementation, but it does not aspire to be the entire system. I don't want reStructuredText or a hypothetical Python documentation processor to die stillborn because of overambition. - Most of all, I want to help ease the documentation chore, the bane of many a programmer. Unfortunately I was sidetracked and stopped working on this project. In November 2000 I made the time to enumerate the problems of StructuredText and possible solutions, and complete the first draft of a specification. This first draft was posted to the Doc-SIG in three parts: - `A Plan for Structured Text`_ - `Problems With StructuredText`_ - `reStructuredText: Revised Structured Text Specification`_ In March 2001 a flurry of activity on the Doc-SIG spurred me to further revise and refine my specification, the result of which you are now reading. An offshoot of the reStructuredText project has been the realization that a single markup scheme, no matter how well thought out, was not enough. In order to tame the endless debates on Doc-SIG, a flexible `Docstring Processing System`_ framework needed to be constructed. This framework has become the more important of the two projects; reStructuredText has found its place as one possible choice for a single component of the larger framework. .. _Digital Creations: http://www.digicool.com .. _ZOPE: http://www.zope.org .. _pythondoc: http://starship.python.net/crew/danilo/pythondoc/ .. _StructuredTextNG: http://dev.zope.org/Members/jim/StructuredTextWiki/StructuredTextNG .. _A Plan for Structured Text: http://mail.python.org/pipermail/doc-sig/2000-November/001239.html .. _Problems With StructuredText: http://mail.python.org/pipermail/doc-sig/2000-November/001240.html .. _[reStructuredText: Revised Structured Text Specification]: http://mail.python.org/pipermail/doc-sig/2000-November/001241.html .. _Docstring Processing System: http://docstring.sf.net .. _parser implementation plan: Parser Implementation Plan ========================== The author will implement a reStructuredText parser in stages, listed below. It will be posted to the `project web site`_, and contributions (of testing, bug reports, patches, administration, encouragement, cookies, large sums of money, etc.) will be welcome. Of course, anyone else is free to begin their own implementation of this markup syntax or alternatives. The parser will be implemented in 4 stages, according to the complexity level and expected frequency of use of the syntax constructs: 1. General markup, level 1 - escaping mechanism, using backslash - body elements - paragraphs - literal blocks - bullet lists - inline markup - emphasis - strong - interpreted text - inline literals - structural markup - section headers - extension markup - directives - comments 2. General markup, level 2 - body elements - definition lists - block quotes - footnotes - internal/indirect hyperlink targets - inline markup - standalone (direct external) hyperlinks - indirect external hyperlinks - internal hyperlinks - footnote references 3. General markup, level 3 - body elements - enumerated lists - field lists - tables 4. Python-specific markup - body elements - doctest blocks - option lists - inline markup - interpreted text (Python interpretation thereof) From dgoodger@bigfoot.com Sun Jun 3 15:34:24 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:34:24 -0400 Subject: [Doc-SIG] Problems With StructuredText Message-ID: ============================== Problems With StructuredText ============================== Author: David Goodger Contact: dgoodger@bigfoot.com Status: second draft Date: 2001-05-31 There are several problems, unresolved issues, and areas of controversy within StructuredText_ (Classic and Next Generation). In order to resolve all these issues, this analysis brings all of the issues out into the open, enumerates all the alternatives, and proposes solutions to be incorporated into the reStructuredText_ specification. 1. No formal specification_. The code *is* the standard. 2. Code is difficult to `understand and extend`_. 3. Section structure via indentation_. 4. No `character escaping mechanism`_. 5. `Blank lines in lists`_. 6. `Bullet list markup`_. 7. Problematic `enumerated list markup`_. 8. Awkward `definition list markup`_. 9. Ambiguous markup for `literal blocks`_. 10. Tables_. 11. `Delimitation of inline markup`_ (must start with whitespace). 12. Awkward underlining_ markup. 13. Awkward `inline literals`_ markup. 14. Awkward `hyperlink markup`_. .. _specification: 1. Formal Specification ======================= The description in the original StructuredText.py has been criticized for being vague. For practical purposes, "the code *is* the spec." Tony Ibbs has been working on deducing a `detailed description`_ from the documentation and code of StructuredTextNG_. Edward Loper's STMinus_ is another attempt to formalize a spec. For this kind of a project, the specification should always preceed the code. Otherwise, the markup is a moving target which can never be adopted as a standard. Of course, a specification may be revised during lifetime of the code, but without a spec there is no visible control and thus no confidence. .. _understand and extend: 2. Understanding and Extending the Code ======================================= The original StructuredText_ is a dense mass of sparsely commented code and inscrutable regular expressions. It was not designed to be extended and is very difficult to understand. StructuredTextNG_ has been designed to allow input (syntax) and output extensions, but its documentation (both internal [comments & docstrings], and external) is inadequate for the complexity of the code itself. For reStructuredText to become truly useful, perhaps even part of Python's standard library, it must have clear, understandable documentation and implementation code. For the implementation of reStructuredText to be taken seriously, it must be a sterling example of the potential of docstrings; the implementation must practice what the specification preaches. .. _indentation: 3. Structure via Indentation ============================ Setext_ required that body text be indented by 2 spaces. The original StructuredText_ and StructuredTextNG_ require that section structure be indicated through indentation, as "inspired by Python". For certain structures (outlines, lists, literal blocks, block quotes) indentation naturally indicates structure or hierarchy. For section structure, indentation is unnatural and awkward. Rather, the style of the section title should indicate its structure. In the original StructuredText, sections consist of one-line title paragraphs followed by indented paragraphs and other body elements. Using indentation is: - Unnatural. Most published works use title style (type size, face, weight, and position) and/or section/subsection numbering rather than indentation to indicate hierarchy. When indentation is used, it is usually the formatted end-result and is there for aesthetic rather than structural purposes. - Awkward. One must think about the formatting as the text is keyed in. And when structural changes are made (it is very common during the composition of a document to rearrange sections and their hierarchy) we must use block-indent and -unindent functions. In order to edit documents using indentation, relatively advanced text editors must be used. Python's significant whitespace is a wonderful innovation (even if not original to Python), however applying indentation to ordinary written text is hypergeneralization. reStructuredText_ indicates section structure through title style (as exemplified by this document). This is far more natural. In fact, it is already in widespread use in plain text documents, including in Python's standard distribution (such as the toplevel README_ file). .. _character escaping mechanism: 4. Character Escaping Mechanism =============================== No matter what characters are chosen for markup, some day someone will want to write documentation *about* that markup or using markup characters in a non-markup context. Therefore, any complete markup language must have an escaping or encoding mechanism. For a lightweight markup system, encoding mechanisms like SGML/XML's '*' are out. So an escaping mechanism is in. However, with carefully chosen markup, it should be necessary to use the escaping mechanism only infrequently. reStructuredText_ needs an escaping mechanism: a way to treat markup-significant characters as the characters themselves. Currently there is no such mechanism (although ZWiki uses '!'). What are the candidates? 1. ! (http://dev.zope.org/Members/jim/StructuredTextWiki/NGEscaping) 2. \ 3. ~ 4. doubling of characters The best choice for this is the backslash (\). It's "the single most popular escaping character in the world!", therefore familiar and unsurprising. Since characters only need to be escaped under special circumstances, which are typically those explaining technical programming issues, the use of the backslash is natural and understandable. Python docstrings can be raw (prefixed with an 'r', as in 'r""'), which would obviate the need for gratuitous doubling-up of backslashes. The rule would be: An unescaped backslash followed by any markup character escapes the character. The escaped character represents the character itself, and is prevented from playing a role in any markup interpretation. The backslash is removed from the output. A literal backslash is represented by an "escaped backslash," two backslashes in a row. A carefully constructed set of recognition rules for inline markup will obviate the need for backslash-escapes in almost all cases; see `Delimitation of Inline Markup`_ below. When an expression (requiring backslashes and other characters used for markup) becomes too complicated and therefore unreadable, a literal block may be used instead. Inside literal blocks, no markup is recognized, therefore backslashes (for the purpose of escaping markup) become unnecessary. We could allow backslashes preceeding non-markup characters to remain in the output. This would make describing regular expressions and other uses of backslashes easier. However, this would complicate the markup rules and would be confusing. .. _Blank lines in lists: 5. Blank Lines in Lists ======================= Oft-requested in Doc-SIG (the earliest reference is dated 1996-08-13) is the ability to write lists without requiring blank lines between items. In docstrings, space is at a premium. Authors want to convey their API or usage information in as compact a form as possible. StructuredText_ requires blank lines between all body elements, including list items, even when boundaries are obvious from the markup itself. In reStructuredText, blank lines are optional between list items. However, in order to eliminate ambiguity, a blank line is required before the first list item and after the last. Nested lists also require blank lines before the list start and after the list end. .. _Bullet list markup: 6. Bullet List Markup ===================== StructuredText_ includes 'o' as a bullet character. This is dangerous and counter to the language-independent nature of the markup. There are many languages in which 'o' is a word. For example, in Spanish: Llamame a la casa o al trabajo. (Call me at home or at work.) And in Japanese (when romanized): Senshuu no doyoubi ni tegami o kakimashita. ([I] wrote a letter on Saturday last week.) If a paragraph containing an 'o' word wraps such that the 'o' is the first text on a line, or if a paragraph begins with such a word, it could be misinterpreted as a bullet list. In reStructuredText_, 'o' is not used as a bullet character. '-', '*', and '+' are the possible bullet characters. .. _enumerated list markup: 7. Enumerated List Markup ========================= StructuredText enumerated lists are allowed to begin with numbers and letters followed by a period or right-parenthesis, then whitespace. This has surprising consequences for writing styles. For example, this is recognized as an enumerated list item by StructuredText:: Mr. Creosote. People will write enumerated lists in all different ways. It is folly to try to come up with the "perfect" format for an enumerated list, and limit the docstring parser's recognition to that one format only. Rather, the parser should recognize a variety of enumerator styles, marking each block as a potential enumerated list item (PELI), and interpret the enumerators of adjacent PELIs to decide whether they make up a consistent enumerated list. If a PELI is labeled with a "1.", and is immediately followed by a PELI labeled with a "2.", we've got an enumerated list. Or "(A)" followed by "(B)". Or "i)" followed by "ii)", etc. The chances of accidentally recognizing two adjacent and consistently labeled PELIs, are acceptably small. For an enumerated list to be recognized, the following must be true: - the list must consist of multiple adjacent list items (2 or more) - the enumerators must all have the same format - the enumerators must be sequential It is also recommended that the enumerator of the first list item be ordinal-1 ('1', 'A', 'a', 'I', or 'i'), as output formats may not be able to begin a list at an arbitrary enumeration. For the future: Should the digits/letters/numerals themselves be interpreted, allowing nested enumerated lists to be created without indentation? Via compound enumerators for example? Simply count the 'length' (number of sub-enumerators) of the compound enumerator:: 1. one 1.a. two 1.a.I. three 2.a. two 2.b.I. three .. _definition list markup: 8. Definition List Markup ========================= StructuredText uses ' -- ' (whitespace, two hyphens, whitespace) on the first line of a paragraph to indicate a definition list item. The ' -- ' serves to separate the term (on the left) from the definition (on the right). Many people use ' -- ' as an em-dash in their text, conflicting with the StructuredText usage. Although the Chicago Manual of Style says that spaces should not be used around an em-dash, Peter Funk pointed out that this is standard usage in German (according to the Duden, the official German reference), and possibly in other languages as well. The widespread use of ' -- ' precludes its use for definition lists; it would violate the "unsurprising" criterion. A simpler, and at least equally visually distinctive construct (proposed by Guido van Rossum, who incidentally is a frequent user of ' -- ') would do just as well:: term 1 Definition. term 2 Definition 2, paragraph 1. Definition 2, paragraph 2. A reStructuredText definition list item consists of a term and a definition. A term is a simple one-line paragraph. A definition is a block indented relative to the term, and may contain multiple paragraphs and other body elements. No blank line preceedes a definition (this distinguishes definition lists from block quotes). .. _literal blocks: 9. Literal Blocks ================= The StructuredText_ specification has literal blocks indicated by 'example', 'examples', or '::' ending the preceeding paragraph. STNG only recognizes '::'; 'example'/'examples' are not implemented. This is good; it fixes an unnecessary language dependency. The problem is what to do with the sometimes- unwanted '::'. In reStructuredText_ '::' at the end of a paragraph indicates that subsequent *indented* blocks are treated as literal text. No further markup interpretation is done within literal blocks (not even backslash-escapes). If the '::' is preceeded by whitespace, '::' is omitted from the output; if '::' was the sole content of a paragraph, the entire paragraph is removed (no 'empty' paragraph remains). If '::' is preceeded by a non-whitespace character, '::' is replaced by ':' (i.e., the extra colon is removed). Thus, a section could begin with a literal block as follows:: Section Title ------------- :: print "this is example literal" .. _tables: 10. Tables ========== The table markup scheme in classic StructuredText was horrible. Its omission from StructuredTextNG is welcome, and its markup will not be repeated here. However, tables themselves are useful in documentation. Alternatives: 1. This format is the most natural and obvious. It was independently invented(no great feat of creation!), and later found to be the format supported by the `Emacs table mode`_:: +------------+------------+------------+--------------+ | Header 1 | Header 2 | Header 3 | Header 4 | +============+============+============+==============+ | Column 1 | Column 2 | Column 3 & 4 span (Row 1) | +------------+------------+------------+--------------+ | Column 1 & 2 span | Column 3 | - Column 4 | +------------+------------+------------+ - Row 2 & 3 | | 1 | 2 | 3 | - span | +------------+------------+------------+--------------+ Tables are described with a visual outline made up of the characters '-', '=', '|', and '+': - The hyphen ('-') is used for horizontal lines (row separators). - The equals sign ('=') is optionally used as a header separator (as of version 1.5.24, this is not supported by the Emacs table mode). - The vertical bar ('|') is used for for vertical lines (column separators). - The plus sign ('+') is used for intersections of horizontal and vertical lines. Row and column spans are possible simply by omitting the column or row separators, respectively. The header row separator must be complete; in other words, a header cell may not span into the table body. Each cell contains body elements, and may have multiple paragraphs, lists, etc. Initial spaces for a left margin are allowed; the first line of text in a cell determines its left margin. 2. Below is a minimalist possibility. It may be better suited to manual input than alternative #1, but there is no Emacs editing mode available. One disadvantage is that it resembles section titles; a one-column table would look exactly like section & subsection titles. :: ============ ============ ============ ============== Column 1 Column 2 Column 3 & 4 span (Row 1) ============ ============ =========================== Column 1 & 2 span Column 3 - Column 4 ------------------------- ------------ - Row 2 & 3 1 2 3 - span ============ ============ ============ ============== The table begins with a top border of equals signs with a space at each column boundary (regardless of spans). Each row is underlined. Internal row separators are underlines of '-', with spaces at column boundaries. The last of the optional head rows is underlined with '=', again with spaces at column boundaries. Column spans have no spaces in their underline. Row spans simply lack an underline at the row boundary. The bottom boundary of the table consists of '=' underlines. A blank line is required following a table. Alternative #1 is the choice adopted by reStructuredText. .. _delimitation of inline markup: 11. Delimitation of Inline Markup ================================= StructuredText specifies that inline markup must begin with whitespace, precluding such constructs as parenthesized or quoted emphatic text:: "**What?**" she cried. (*exit stage left*) The `reStructuredText markup specification`_ allows for such constructs and disambiguates inline markup through a set of recognition rules. These recognition rules define the context of markup start-strings and end-strings, allowing markup characters to be used in non-markup contexts without a problem (or even a backslash). So we can say, "Use asterisks (*) around words or phrases to *emphasisze* them." The '(*)' will not be recognized as markup. This reduces the need for markup escaping to the point where an escape character is *almost* (but not quite!) unnecessary. .. _underlining: 12. Underlining =============== StructuredText uses '_text_' to indicate underlining. To quote David Ascher in his 2000-01-21 Doc-SIG mailing list post, "Docstring grammar: a very revised proposal": The tagging of underlined text with _'s is suboptimal. Underlines shouldn't be used from a typographic perspective (underlines were designed to be used in manuscripts to communicate to the typesetter that the text should be italicized -- no well-typeset book ever uses underlines), and conflict with double-underscored Python variable names (__init__ and the like), which would get truncated and underlined when that effect is not desired. Note that while *complete* markup would prevent that truncation ('__init__'), I think of docstring markups much like I think of type annotations -- they should be optional and above all do no harm. In this case the underline markup does harm. Underlining is not part of the reStructuredText specification. .. _inline literals: 13. Inline Literals =================== StructuredText's markup for inline literals (text left as-is, verbatim, usually in a monospaced font; as in HTML ) is single quotes ('literals'). The problem with single quotes is that they are too often used for other purposes: - Apostrophes: "Don't blame me, 'cause it ain't mine, it's Chris'."; - Quoting text: First Bruce: "Well Bruce, I heard the prime minister use it. 'S'hot enough to boil a monkey's bum in 'ere your Majesty,' he said, and she smiled quietly to herself." In the UK, single quotes are used for dialogue in published works. - String literals: s = '' Alternatives:: 'text' \'text\' ''text'' "text" \"text\" ""text"" #text# @text@ `text` ^text^ ``text'' ``text`` The examples below contain inline literals, quoted text, and apostrophes. Each example should evaluate to the following HTML:: Some code, with a 'quote', "double", ain't it grand? Does a[b] = 'c' + "d" + `2^3` work? 0. Some code, with a quote, double, ain't it grand? Does a[b] = 'c' + "d" + `2^3` work? 1. Some 'code', with a \'quote\', "double", ain\'t it grand? Does 'a[b] = \'c\' + "d" + `2^3`' work? 2. Some \'code\', with a 'quote', "double", ain't it grand? Does \'a[b] = 'c' + "d" + `2^3`\' work? 3. Some ''code'', with a 'quote', "double", ain't it grand? Does ''a[b] = 'c' + "d" + `2^3`'' work? 4. Some "code", with a 'quote', \"double\", ain't it grand? Does "a[b] = 'c' + "d" + `2^3`" work? 5. Some \"code\", with a 'quote', "double", ain't it grand? Does \"a[b] = 'c' + "d" + `2^3`\" work? 6. Some ""code"", with a 'quote', "double", ain't it grand? Does ""a[b] = 'c' + "d" + `2^3`"" work? 7. Some #code#, with a 'quote', "double", ain't it grand? Does #a[b] = 'c' + "d" + `2^3`# work? 8. Some @code@, with a 'quote', "double", ain't it grand? Does @a[b] = 'c' + "d" + `2^3`@ work? 9. Some `code`, with a 'quote', "double", ain't it grand? Does `a[b] = 'c' + "d" + \`2^3\`` work? 10. Some ^code^, with a 'quote', "double", ain't it grand? Does ^a[b] = 'c' + "d" + `2\^3`^ work? 11. Some ``code'', with a 'quote', "double", ain't it grand? Does ``a[b] = 'c' + "d" + `2^3`'' work? 12. Some ``code``, with a 'quote', "double", ain't it grand? Does ``a[b] = 'c' + "d" + `2^3\``` work? Backquotes (#9) are the best choice. They are unobtrusive and relatviely rarely used (more rarely than ' or ", anyhow). Backquotes have the connotation of 'quotes', which other options (like carets, #10) don't. When used within literals, they can be escaped (\`). Analogously with *emph* & **strong**, double-backquotes (#12) could be used for inline literals. If single-backquotes are used for 'interpreted text' (context-sensitive domain-specific descriptive markup) such as function name hyperlinks in Python docstrings, then double-backquotes could be used for absolute-literals, wherein no processing whatsoever takes place. An advantage of double-backquotes would be that backslash-escaping would no longer be necessary for embedded single-backquotes; however, embedded double-backquotes (in an end-string context) would be illegal. Alternative choices are carets (#10) and TeX-style quotes (#11). For examples of TeX-style quoting, see: http://www.zope.org/Members/jim/StructuredTextWiki/CustomizingTheDocumentPro cessor Some existing uses of backquotes: 1. As a synonym for repr() in Python. 2. For command-interpolation in shell scripts. 3. Used as open-quotes in TeX code (and carried over into plaintext by TeXies). The inline markup start-string and end-string recognition rules defined by the `reStructuredText markup specification`_ would allow all of these cases inside inline literals, with very few exceptions. As a fallback, literal blocks could handle all cases. Outside of inline literals, the above uses of backquotes would require backslash-escaping. However, these are all prime examples of text that should be marked up with inline literals. If either backquotes or straight single-quotes are used as markup, TeX-quotes are too troublesome to support, so no special-casing of TeX-quotes should be done (at least at first). If TeX-quotes have to be used outside of literals, a single backslash-escaped would suffice: \``TeX quote''. Ugly, true, but very infrequently used. Using literal blocks is a fallback option which removes the need for backslash-escaping:: like this:: Here, we can do ``absolutely'' anything `'`'\|/|\ we like! No mechanism for inline literals is perfect, just as no escaping mechanism is perfect. No matter what we use, complicated inline expressions involving the inline literal quote and/or the backslash will end up looking ugly. We can only choose the least often ugly option. .. _hyperlink markup: 14. HyperLinks ============== There are three forms of hyperlink currently in StructuredText_: 1. (Absolute & relative URIs.) Text enclosed by double quotes followed by a colon, a URI, and concluded by punctuation plus white space, or just white space, is treated as a hyperlink:: "Python":http://www.python.org/ 2. (Absolute URIs only.) Text enclosed by double quotes followed by a comma, one or more spaces, an absolute URI and concluded by punctuation plus white space, or just white space, is treated as a hyperlink:: "mail me", mailto:me@mail.com 3. (Endnotes.) Text enclosed by brackets link to an endnote at the end of the document: at the beginning of the line, two dots, a space, and the same text in brackets, followed by the end note itself:: Please refer to the fine manual [GVR2001]. .. [GVR2001] Python Documentation, Release 2.1, van Rossum, Drake, et al., http://www.python.org/doc/ The problem with forms 1 and 2 is that they are neither intuitive nor unobtrusive (they break design goals 5 & 2). They overload double-quotes, which are too often used in ordinary text (potentially breaking design goal 4). The brackets in form 3 are also too common in ordinary text (such as [nested] asides and Python lists like [12]). Alternatives: 1. Have no special markup for hyperlinks. 2. A. Interpret and mark up hyperlinks as any contiguous text containing '://' or ':...@' (absolute URI) or '@' (email address) after an alphanumeric word. To de-emphasize the URI, simply enclose it in parentheses: Python (http://www.python.org/) B. Leave special hyperlink markup as a domain-specific extension. Hyperlinks in ordinary reStructuredText documents would be required to be standalone (i.e. the URI text inline in the document text). Processed hyperlinks (where the URI text is hidden behind the link) are important enough to warrant syntax. 3. The original Setext_ introduced a mechanism of indirect hyperlinks. A source link word ('hot word') in the text was given a trailing underscore:: Here is some text with a hyperlink_ built in. The hyperlink itself appeared at the end of the document on a line by itself, beginning with two dots, a space, the link word with a leading underscore, whitespace, and the URI itself:: .. _hyperlink http://www.123.xyz Setext used 'underscores_instead_of_spaces_' for phrase links. With some modification, alternative 3 best satisfies the design goals. It has the advantage of being readable and relatively unobtrusive. Since each source link must match up to a target, the odd variable ending in an underscore can be spared being marked up (although it should generate a "no such link target" warning). The only disadvantage is that phrase-links aren't possible without some obtrusive syntax. We could achieve phrase-links if we enclose the link text: 1. in double quotes:: "like this"_ 2. in brackets:: [like this]_ 3. or in backquotes:: `like this`_ Each gives us somewhat obtrusive markup, but that is unavoidable. The bracketed syntax (#2) is reminiscent of links on many web pages (intuitive), although it is somewhat obtrusive. Alternative #3 is much less obtrusive, and is not inconsistent with interpreted text: the trailing underscore indicates the interpretation of the phrase, as a hyperlink. #3 also disambiguates hyperlinks from footnote references. Alternative #3 wins. The same trailing underscore markup can also be used for footnotes, removing the problem with ordinary bracketed text and Python lists:: Please refer to the fine manual [GVR2000]_. .. _[GVR2000] Python Documentation, van Rossum, Drake, et al., http://www.python.org/doc/ The two-dots-and-a-space syntax was generalized by Setext for comments, which are removed from the (visible) processed output. reStructuredText uses this syntax for comments, footnotes, and link target. For link targets, in order to eliminate ambiguity with comments and footnotes, reStructuredText specifies that a colon always follow the link target word/phrase. The colon denotes 'maps to'. There is no reason to restrict target links to the end of the document; they could just as easily be interspersed. Internal hyperlinks (links from one point to another within a single document) can be expressed by a source link as before, and a target link with a colon but no URI. In effect, these targets 'map to' the element immediately following. As an added bonus, we now have a perfect candidate for reStructuredText directives, a simple extension mechanism: a comment containing a single word followed by two colons and whitespace. The interpretation of subsequent data on the directive line or following is directive-dependent. To summarize:: .. This is a comment. .. The line below is an example of a directive. .. version:: 1 This is a footnote [1]_. This internal hyperlink will take us to the footnotes_ area below. Here is a one-word_ indirect hyperlink. Here is `an indirect hyperlink phrase`_. .. _footnotes: .. _[1] Footnote text goes here. .. indirect hyperlink target mappings: .. _one-word: http://www.123.xyz .. _an indirect hyperlink phrase: http://www.123.xyz The presence or absence of a colon after the target link differentiates an indirect hyperlink from a footnote, respectively. A footnote requires brackets. Backquotes around a target link word or phrase are required if the phrase contains a colon, optional otherwise. Below are examples using no markup, the two StructuredText hypertext styles, and the reStructuredText hypertext style. Each example contains an indirect link, a direct link, a footnote/endnote, and bracketed text. In HTML, each example should evaluate to::

A URI, see [eggs2000] (in Bacon [Publisher]). Also see http://eggs.org.

[eggs2000] "Spam, Spam, Spam, Eggs, Bacon, and Spam"

1. No markup:: A URI http://spam.org, see eggs2000 (in Bacon [Publisher]). Also see http://eggs.org. eggs2000 "Spam, Spam, Spam, Eggs, Bacon, and Spam" 2. StructuredText absolute/relative URI syntax ("text":http://www.url.org):: A "URI":http://spam.org, see [eggs2000] (in Bacon [Publisher]). Also see "http://eggs.org":http://eggs.org. .. [eggs2000] "Spam, Spam, Spam, Eggs, Bacon, and Spam" Note that StructuredText does not recognize standalone URIs, forcing doubling up as shown in the second line of the example above. 3. StructuredText absolute-only URI syntax ("text", mailto:you@your.com):: A "URI", http://spam.org, see [eggs2000] (in Bacon [Publisher]). Also see "http://eggs.org", http://eggs.org. .. [eggs2000] "Spam, Spam, Spam, Eggs, Bacon, and Spam" 4. reStructuredText syntax:: 4. A URI_, see [eggs2000]_ (in Bacon [Publisher]). Also see http://eggs.org. .. _URI: http:/spam.org .. _[eggs2000] "Spam, Spam, Spam, Eggs, Bacon, and Spam" The bracketed text '[Publisher]' may be problematic with StructuredText (syntax 2 & 3). reStructuredText's syntax (#4) is definitely the most readable. The text is separated from the link URI and the footnote, resulting in cleanly readable text. .. _StructuredText: http://dev.zope.org/Members/jim/StructuredTextWiki/FrontPage .. _Setext: http://www.bsdi.com/setext .. _reStructuredText: http://structuredtext.sf.net .. _detailed description: http://www.tibsnjoan.demon.co.uk/STNG-format.html .. _STMinus: http://www.cis.upenn.edu/~edloper/pydoc/stminus.html .. _StructuredTextNG: http://dev.zope.org/Members/jim/StructuredTextWiki/StructuredTextNG .. _README: http://cvs.sf.net/cgi-bin/cvsweb.cgi/python/dist/src/README?cvsroot=python .. _Emacs table mode: http://table.sf.net/ .. _reStructuredText Markup Specification: http://structuredtext.sf.net/spec/reStructuredText.txt From dgoodger@bigfoot.com Sun Jun 3 15:35:11 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:35:11 -0400 Subject: [Doc-SIG] reStructuredText Markup Specification Message-ID: ======================================= reStructuredText Markup Specification ======================================= Author: David Goodger Contact: dgoodger@bigfoot.com Version: 0.2 Date: 2001-05-29 reStructuredText_ is plain text that uses simple and intuitive constructs to indicate the structure of a document. These constructs are equally easy to read in raw and processed forms. This document is itself an example of reStructuredText (raw, if you are reading the text file, or processed, if you are reading an HTML document, for example). reStructuredText is a candidate markup syntax for the `Python Docstring Processing System`_. Simple, implicit markup is used to indicate special constructs, such as section headings, bullet lists, and emphasis. The markup used is as minimal and unobtrusive as possible. Less often-used constructs and extensions to the basic reStructuredText syntax may have more elaborate or explicit markup. The first section gives a quick overview of the syntax of the reStructuredText markup by example. More details are given in the `Syntax Details`_ section. `Literal blocks`_ are used for examples throughout this document. ----------------------- Quick Syntax Overview ----------------------- A reStructuredText document is made up of body elements, and may be structured into sections. `Section Structure`_ is indicated through title style (underlines & optional overlines). Sections contain body elements and/or subsections. Here are examples of body elements: - Paragraphs_ (and `inline markup`_):: Paragraphs contain text and may contain inline markup: *emphasis*, **strong emphasis**, `interpreted text`, ``inline literals``, standalone hyperlinks (http://www.python.org), indirect hyperlinks (Python_), internal cross-references (example_), footnote references ([1]_). Paragraphs are separated by blank lines and are flush left. - Three types of lists: 1. `Bullet lists`_:: - This is a bullet list. - Bullets can be '-', '*', or '+'. 2. `Enumerated lists`_:: 1. This is an enumerated list. 2. Enumerators may be arabic numbers, letters, or roman numerals. 3. `Definition lists`_:: what Definition lists associate a term with a definition. how The term is a one-line phrase, and the definition is one or more paragraphs or body elements, indented relative to the term. - `Literal blocks`_:: Literal blocks are indented, and indicated with a double-colon ('::') at the end of the preceeding paragraph:: if literal_block: text = 'is left as-is' spaces_and_linebreaks = 'are preserved' markup_processing = None - `Block quotes`_:: Block quotes consist of indented body elements: This theory, that is mine, is mine. Anne Elk (Miss) - Tables_:: +------------------------+------------+----------+ | Header row, column 1 | Header 2 | Header 3 | +========================+============+==========+ | body row 1, column 1 | column 2 | column 3 | +------------------------+------------+----------+ | body row 2 | Cells may span | +------------------------+------------+----------+ - Comments_:: .. Comments begin with two dots and a space. Anything may follow, except for the syntax of directives, footnotes, and hyperlink targets, described below. - Directives_:: .. graphic:: mylogo.png - Footnotes_:: .. _[1] A footnote contains indented body elements. It is a form of hyperlink target. - `Hyperlink targets`_:: .. _Python: http://www.python.org .. _example: The '_example' target above points to this paragraph. .. _syntax details: ---------------- Syntax Details ---------------- Below is a diagram of the hierarchy of element types in reStructuredText. Elements may contain other elements below them. Element types in parentheses indicate recursive or one-to-many relationships: sections may contain (sub)sections, tables contain further body elements, etc. :: +------------------------------------------------------------------+ | document | | +--------------------------------------+ | [root element] | +-------+ | | | sections [begin with one | title |] | | | +-------+ | |---------------------------+-------------------------+------------| | [body elements:] | (sections) | | | | - lists | | - comments +------------+ | | | - tables | | - directives | | para- | literal | - block | foot- | - hyperlink | | graphs | blocks | quotes | notes | targets | +---------+---------+----------+-------+--------------+ | [text]+ | [text] | (body elements) | [text] | | (inline +---------+------------------+--------------+ | markup) | +---------+ For definitive element hierarchy details, see the "Generic Plaintext Document Interface DTD" XML document type definition, gpdi.dtd_. Descriptions below list 'DTD elements' (XML 'generic identifiers') corresponding to syntax constructs. .. _whitespace: Whitespace ========== Blank lines are used to separate paragraphs and other elements. Blank lines may be omitted when the markup makes element separation unambiguous. Indentation is used to indicate, and is only significant in indicating: - multiple body elements within a list item (including nested lists), - the definition part of a definition list item, - block quotes, and - the extent of literal blocks. Although spaces are recommended for indentation, tabs may also be used. Tabs will be converted to spaces. Tab stops are at every 8th column. .. _escaping mechanism: Escaping Mechanism ================== The character set available in plain text documents, 7-bit ASCII, is limited. No matter what characters are used for markup, they will already have multiple meanings in written text. Therefore markup characters *will* sometimes appear in text **without being intended as markup**. Any serious markup system requires an escaping mechanism to override the default meaning of the characters used for the markup. In reStructuredText we use the backslash, commonly used as an escaping character in other domains. A backslash followed by any character escapes the character. The escaped character represents the character itself, and is prevented from playing a role in any markup interpretation. The backslash is removed from the output. A literal backslash is represented by two backslashes in a row. There are two contexts in which backslashes have no special meaning: literal blocks and inline literals. In these contexts, a single backslash represents a literal backslash. .. _section structure: Section Structure ================= DTD elements: section, title. Sections are identified through their titles, which are marked up with 'underlines' below the title text (and, in some cases, 'overlines' above the title). An underline/overline is a line of non-alphanumeric characters that begins in column 1 and extends at least as far as the right edge of the title text. When there an overline is used, the length and character used must match the underline. There may be any number of levels of section titles. Rather than imposing a fixed number and order of section title styles, the order enforced will be the order as encountered. The first style encountered will be an outermost title (like HTML H1), the second style will be a subtitle, the third will be a subsubtitle, and so on. Below are examples of section title styles:: =============== Section Title =============== --------------- Section Title --------------- Section Title ============= Section Title ------------- Section Title ............. Section Title ~~~~~~~~~~~~~ Section Title ************* Section Title +++++++++++++ Section Title ^^^^^^^^^^^^^ When a title has both an underline and an overline, the title text may be inset, as in the first two examples above. This is merely aesthetic and not significant. Underline-only title text may not be inset. A blank line after a title is optional. All text blocks up to the next title of the same or higher level are included in a section (or subsection, etc.). All section title styles need not be used, nor must any specific section title style be used. However, a document must be consistent in its use of section titles: once a hierarchy of title styles is established, sections must use that hierarchy. .. _body elements: Body Elements ============= .. _paragraphs: Paragraphs ---------- DTD element: paragraph. Paragraphs consist of blocks of left-aligned text with no markup indicating any other body element. Blank lines separate paragraphs from each other and from other body elements. Paragraphs may contain `inline markup`_. Syntax diagram:: +------------------------------+ | paragraph | | | +------------------------------+ +------------------------------+ | paragraph | | | +------------------------------+ .. _bullet lists: Bullet Lists ------------ DTD elements: bullet_list, list_item. A text block which begins with a '-', '*', or '+', followed by whitespace, is a bullet list item (a.k.a. 'unordered' list item). For example:: - This is the first bullet list item. The blank line above the first list item is required; blank lines between list items (such as below this paragraph) are optional. Text blocks must be left-aligned, indented relative to the bullet. - This is the first paragraph in the second item in the list. This is the second paragraph in the second item in the list. The blank line above this paragraph is required. The left edge of this paragraph lines up with the paragraph above, both indented relative to the bullet. - This is a sublist. The bullet lines up with the left edge of the text blocks above. A sublist is a new list so requires a blank line above and below. - This is the third item of the main list. This paragraph is not part of the list. Here are examples of **incorrectly** formatted bullet lists:: - This first line is fine. A blank line is required between list items and paragraphs. (Warning) - The following line appears to be a new sublist, but it is not: - This is a paragraph contination, not a sublist (no blank line). - Warnings may be issued by the implementation. Syntax diagram:: +------+-----------------------+ | '- ' | list item | +------| (body elements)+ | +-----------------------+ .. _enumerated lists: Enumerated Lists ---------------- DTD elements: enumerated_list, list_item. Enumerated lists (a.k.a. 'ordered' lists) are similar to bullet lists, but use enumerators instead of bullets. An enumerator consists of an enumeration sequence member and formatting, followed by whitespace. The following enumeration sequences are recognized: - arabic numerals: 1, 2, 3, ... (no upper limit). - uppercase alphabet characters: A, B, C, ..., Z. - lower-case alphabet characters: a, b, c, ..., z. - uppercase Roman numerals: I, II, III, IV, ... (no upper limit). - lowercase Roman numerals: i, ii, iii, iv, ... (no upper limit). The following formatting types are recognized: - suffixed with a period: '1.', 'A.', 'a.', 'I.', 'i.'. - surrounded by parentheses: '(1)', '(A)', '(a)', '(I)', '(i)'. - suffixed with a right-parenthesis: '1)', 'A)', 'a)', 'I)', 'i)'. For an enumerated list to be recognized, the following must hold true: 1. The list must consist of multiple adjacent list items (2 or more). 2. The enumerators must all have the same format and sequence type. 3. The enumerators must be in sequence (i.e., '1.', '3.' is not allowed). It is recommended that the enumerator of the first list item be ordinal-1 ('1', 'A', 'a', 'I', or 'i'). Although other start-values will be recognized, they may not be supported by the output format. Nested enumerated lists must be created with indentation. For example:: 1. Item 1. a) item 1a. b) Item 1b. .. _definition lists: Definition Lists ----------------- DTD elements: definition_list, definition_list_item, term, definition. Each definition list item contains a term and a definition. A term is a simple one-line paragraph. A definition is a block indented relative to the term, and may contain multiple paragraphs and other body elements. Blank lines are required before the term and after the definition, but there may be no blank line between a term and a definition (this distinguishes definition lists from `block quotes`_). :: term 1 Definition 1. term 2 Definition 2, paragraph 1. Definition 2, paragraph 2. Syntax diagram:: +------+ | term | +--+---+-----------------------+ | defninition | | (body elements)+ | +---------------------------+ .. _field lists: Field Lists ----------- DTD elements: field_list, field, field_name, field_argument, field_body. .. XXX Syntax under construction. Comments and suggestions welcome. Field lists are mappings from field names to field bodies, modeled on RFC822_ headers. A field name is made up of one or more letters, numbers, and punctuation, except colons (':') and whitespace. A single colon and whitespace follows the field name, and this is followed by the field body. The field body may contain multiple body elements. Applications of reStructuredText may recognize field names and transform fields or field bodies in certain contexts. Field names are case-insensitive. Any untransformed fields remain in the field list as the document's first body element. The syntax for field lists has not been finalized. Syntax alternatives: 1. Unadorned RFC822_ everywhere:: Author: Me Version: 1 Advantages: clean, precedent. Disadvantage: ambiguous (these paragraphs are a prime example). Conclusion: rejected. 2. Special case: use unadorned RFC822_ for the very first or very last text block of a docstring:: """ Author: Me Version: 1 The rest of the docstring... """ Advantages: clean, precedent. Disadvantages: special case, flat (unnested) field lists only. Conclusion: accepted, see below. 3. Use a directive:: .. fields:: Author: Me Version: 1 Advantages: explicit and unambiguous. Disadvantage: cumbersome. 4. Use Javadoc-style:: @Author: Me @Version: 1 @param a: integer Advantages: unambiguous, precedent, flexible. Disadvantages: non-intuitive, ugly. One special context is defined for field lists. A field list as the very first non-comment block, or the second non-comment block immediately after a title, is interpreted as document bibliographic data. No special syntax is required, just unadorned RFC822_. The first block ends with a blank line, therefore field bodies must be single paragraphs only and there may be no blank lines between fields. The following field names are recognized and transformed to the corresponding DTD elements listed, child elements of the 'document' element. No ordering is imposed on these fields: - Title: title - Subtitle: subtitle - Author/Authors: author - Organization: organization - Contact: contact - Version: version - Status: status - Date: date - Copyright: copyright This field-name-to-element mapping can be extended, or replaced for other languages. See the implementation documentation for details. .. _literal blocks: Literal Blocks -------------- DTD element: literal_block. Two colons ('::') at the end of a paragraph signifies that all following **indented** text blocks comprise a literal block. No markup processing is done within a literal block. It is left as-is, and is typically rendered in a monospaced typeface:: This is a typical paragraph. A literal block follows:: for a in [5,4,3,2,1]: # this is program code, formatted as-is print a print "it's..." # a literal block continues until the indentation ends This text has returned to the indentation of the first paragraph, is outside of the literal block, and therefore treated as an ordinary paragraph. When '::' is immediately preceeded by whitespace, both colons will be removed from the output. When text immediately preceeds the '::', *one* colon will be removed from the output, leaving only one (i.e., '::' will be replaced by ':'). When '::' is alone on a line, it will be completely removed from the output; no empty paragraph will remain. In other words, these are all equivalent: 1. Minimized:: Paragraph:: Literal block 2. Partly expanded:: Paragraph: :: Literal block 3. Fully expanded:: Paragraph: :: Literal block The minimum leading whitespace will be removed from each line of the literal block. Other than that, all whitespace (including line breaks) is preserved. Blank lines are required before and after a literal block, but these blank lines are not included as part of the literal block. Syntax diagram:: +------------------------------+ | paragraph | | (ends with '::') | +------------------------------+ +---------------------------+ | literal block | +---------------------------+ .. _block quotes: Block Quotes ------------ DTD element: block_quote. A text block that is indented relative to the preceeding text, without markup indicating it to be a literal block, is a block quote. All markup processing (for body elements and inline markup) continues within the block quote:: This is an ordinary paragraph, introducing a block quote: "It is my business to know things. That is my trade." --Sherlock Holmes Blank lines are required before and after a block quote, but these blank lines are not included as part of the block quote. Syntax diagram:: +------------------------------+ | (current level of | | indentation) | +------------------------------+ +---------------------------+ | block quote | | (body elements)+ | +---------------------------+ .. _tables: Tables ------ DTD elements: table, tgroup, colspec, thead, tbody, row, entry. Tables are described with a visual outline made up of the characters '-', '=', '|', and '+'. The hyphen ('-') is used for horizontal lines (row separators). The equals sign ('=') may be used to separate optional header rows from the table body. The vertical bar ('|') is used for vertical lines (column separators). The plus sign ('+') is used for intersections of horizontal and vertical lines. Each cell contains zero or more body elements. Example:: +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | Cells may span columns. | +------------------------+------------+---------------------+ | body row 3 | Cells may | - Table cells | +------------------------+ span rows. | - contain | | body row 4 | | - body elements. | +------------------------+------------+---------------------+ As with other body elements, blank lines are required before and after tables. Tables' left edges should align with the left edge of preceeding text blocks; otherwise, the table is considered to be part of a block quote. Comment Blocks -------------- A comment block is a text block: - whose first line begins with '.. ' (the 'comment start'), - whose second and subsequent lines are indented relative to the first, and - which ends with an unindented line. Comments are analogous to bullet lists, with '..' as the bullet. Blank lines are required between comment blocks and other elements, but are optional between comment blocks where unambiguous. The comment block syntax is used for comments, directives, footnotes, and hyperlink targets. .. _comments: Comments ........ DTD element: comment. Arbitrary text may follow the comment start and will be processed as a comment element, possibly being removed from the processed output. The only restriction on comments is that they not use the same syntax as directives, footnotes, or hyperlink targets. Syntax diagram:: +-------+----------------------+ | '.. ' | comment block | +--+----+ | | | +---------------------------+ .. _directives: Directives .......... DTD element: directive. Directives are indicated by a comment start followed by a single word (the directive type, regular expression '`[a-zA-Z][a-zA-Z0-9_-]*`'), two colons, and whitespace. Two colons are used for these reasons: - To avoid clashes with common comment text like:: .. Danger: modify at your own risk! - If an implementation of reStructuredText does not recognize a directive (i.e., the directive-handler is not installed), the entire directive block (including the directive itself) will be treated as a literal block, and a warning generated. Thus '::' is a natural choice. Directive names are case-insensitive. Actions taken in response to directives and the interpretation of data in the directive block or subsequent text block(s) are directive-dependent. No directives have been defined by the core reStructuredText specification. The following are only examples of *possible uses* of directives. Directives can be used as an extension mechanism for reStructuredText. For example, hhere's how a graphic could be placed:: .. graphic:: mylogo.png A figure (a graphic with a caption) could be placed like this:: .. figure:: larch.png The larch. Directives can also be used as pragmas, to modify the behavior of the parser, such as to experiment with alternate syntax. Syntax diagram:: +-----------------+------------+ | '.. ' type '::' | directive | +--+--------------+ block | | | +---------------------------+ .. _hyperlink targets: Hyperlink Targets ................. DTD element: target. Hyperlink targets consist of a comment start ('.. '), an underscore, the hyperlink name (no trailing underscore), a colon, whitespace, and a link block. Hyperlink targets go together with `indirect hyperlinks`_ and `internal hyperlinks`_. Internal hyperlink targets have empty link blocks; they point to the next element. Indirect hyperlink targerss have an absolute or relative URI in their link blocks. If a hyperlink name contains colons, either: - the phrase must be enclosed in backquotes:: .. _`FAQTS: Computers: Programming: Languages: Python`: http://python.faqts.com/ - or the colon(s) must be backslash-escaped in the link target:: .. _Chapter One\: 'Tadpole Days': It's not easy being green... Whitespace is normalized within hyperlink names, which are case-insensitive. Syntax diagram:: +-----------------+------------+ | '.. _' name ':' | link | +--+--------------+ block | | | +---------------------------+ .. _footnotes: Footnotes ......... DTD elements: footnote, label. Footnotes are similar to hyperlink targets: a comment start, an underscore, open square bracket, footnote label, close square bracket, and whitespace. To differentiate footnotes from hyperlink targets: - the square brackets are used, - the footnote label may not contain whitespace, - no colon appears after the close bracket. Footnotes may occur anywhere in the document, not necessarily at the end. Where or how they appear in the processed output depends on the output formatter. Here is a footnote, referred to in `Footnote References`_:: .. _[GVR2001] Python Documentation, van Rossum, Drake, et al., http://www.python.org/doc/ Syntax diagram:: +-------------------+----------+ | '.. _[' label ']' | footnote | +--+----------------+ | | (body elements)+ | +---------------------------+ .. _inline markup: Inline Markup ============= Inline markup is the markup of text within a text block. Inline markup cannot be nested. There are six inline markup constructs. Four of the constructs (emphasis_, `strong emphasis`_, `interpreted text`_, and `inline literals`_) use start-strings and end-strings to indicate the markup. The `indirect hyperlink`_ construct (shared by `internal hyperlinks`_) uses an end-string only. `Standalone hyperlinks`_ are interpreted implicitly, and use no extra markup. The inline markup start-string and end-string recognition rules are as follows: 1. Inline markup start-strings must be immediately preceeded by whitespace and zero or more of single or double quotes, '(', '[', or '{'. 2. Inline markup start-strings must be immediately followed by non-whitespace. 3. Inline markup end-strings must be immediately preceeded by non-whitespace. 4. Inline markup end-strings must be immediately followed by zero or more of single or double quotes, '.', ',', ':', ';', '!', '?', '-', ')', ']', or '}', followed by whitespace. 5. If an inline markup start-string is immediately preceeded by a single or double quote, '(', '[', or '{', it must not be immediately followed by the corresponding single or double quote, ')', ']', or '}'. 6. An inline markup end-string must be separated by at least one character from the start-string. 7. Except for the end-string of `inline literals`_, an unescaped backslash preceeding a start-string or end-string will disable markup recognition. See `escaping mechanism`_ above for details. For example, none of the following are recognized as inline markup start-strings: ' * ', '"*"', "'*'", '(*)', '(* ', '[*]', '{*}', '\*', ' ` ', etc. .. _emphasis: Emphasis -------- DTD element: emphasis. Text enclosed by single asterisk characters (start-string = end-string = '*') is emphasized:: This is *emphasized text*. Emphasized text is typically displayed in italics. .. _strong emphasis: Strong Emphasis --------------- DTD element: strong. Text enclosed by double-asterisks (start-string = end-string = '**') is emphasized strongly:: This is **strong text**. Strongly emphasized text is typically displayed in boldface. .. _interpreted text: Interpreted Text ---------------- DTD element: interpreted. Text enclosed by single backquote characters (start-string = end-string = '`') is interpreted:: This is `interpreted text`. The semantics of interpreted text are domain-dependent. It can be used as implicit or explicit descriptive markup (such as for program identifiers, as in the `Python Extensions`_ to reStructuredText), for cross-reference interpretation (such as index entries), or for other applications where context can be inferred. The role of the interpreted text may be inferred implicitly. The role of the interpreted text may also be indicated explicitly, either a prefix (role + colon + space) or a suffix (space + colon + role), depending on which reads better:: `role: interpreted text` `interpreted text :role` .. _inline literals: Inline Literals --------------- DTD element: literal. Text enclosed by double-backquotes (start-string = end-string = '``') is treated as inline literals:: This text is an example of ``inline literals``. Inline literals may contain any characters except two adjacent backquotes in an end-string context (according to the recognition rules above). No markup interpretation (including backslash-escape interpretation) is done within inline literals. Line breaks are *not* preserved; other whitespace is not guaranteed to be preserved. Inline literals are useful for short code snippets. For example:: The regular expression ``[+-]?(\d+(\.\d*)?|\.\d+)`` matches non-exponential floating-point numbers. .. _hyperlinks: Hyperlinks ---------- Hyperlinks are indicated by a trailing underscore, '_', except for `standalone hyperlinks`_ which are recognized independently. .. _standalone hyperlinks: Standalone Hyperlinks ..................... DTD element: link. An absolute URI [URI]_ within a text block is treated as a general external hyperlink with the URI itself as the link's text (start-string = end-string = '', the empty string). For example:: See http://www.python.org for info. would be marked up in HTML as:: See http://www.python.org for info. .. _[URI] Uniform Resource Identifier. URIs are a general form of URLs (Uniform Resource Locators). For the syntax of URIs see RFC2396_. .. _indirect hyperlinks: Indirect Hyperlinks ................... DTD element: link. Indirect hyperlinks consist of two parts. In the text body, there is a source link, a name with a trailing underscore (start-string = '', end-string = '_'; start-string = '`', end-string = '`_'):: See the Python_ home page for info. Somewhere else in the document is a target link containing a URI (see `Hyperlink Targets`_ for a full description):: .. _Python: http://www.python.org After processing into HTML, this should be expressed as:: See the Python home page for info. Phrase-links (a hyperlink whose name is a phrase, two or more space-separated words) can be expressed by enclosing the phrase in backquotes and treating the backquoted text as a link name:: Want to learn about `my favorite programming language`_? .. _my favorite programming language: http://www.python.org Whitespace is normalized within hyperlink names, which are case-insensitive. .. _internal hyperlinks: Internal Hyperlinks ................... DTD element: link. Internal hyperlinks connect one point to another within a document. They are identical to indirect hyperlinks (start-string = '', end-string = '_'; start-string = '`', end-string = '`_') except that there is no URI in the target link. See `Hyperlink Targets`_ for a full description. For example:: Clicking on this internal hyperlink will take us to the target_ below. .. _target: The hyperlink target above points to this paragraph. .. _footnote references: Footnote References ................... DTD element: footnote_reference. Footnote references consist of a square-bracketed label (no whitespace), with a trailing underscore (start-string = '[', end-string = ']_'):: Please refer to the fine manual [GVR2001]_. See Footnotes_ for the footnote itself. .. _reStructuredText: http://structuredtext.sf.net .. _Python Docstring Processing System: http://docstring.sf.net .. _Doc-SIG: http://www.python.org/sigs/doc-sig/ .. _gpdi.dtd: http://docstring.sf.net/spec/gpdi.dtd .. _RFC822: http://www.rfc-editor.org/rfc/rfc822.txt .. _RFC2396: http://www.rfc-editor.org/rfc/rfc2396.txt .. _Python Extensions: http://structuredtext.sf.net/spec/pyextensions.txt From dgoodger@bigfoot.com Sun Jun 3 15:35:39 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 10:35:39 -0400 Subject: [Doc-SIG] Python Extensions to the reStructuredText Markup Specification Message-ID: ================================================================ Python Extensions to the reStructuredText Markup Specification ================================================================ Author: David Goodger Contact: dgoodger@bigfoot.com Version: 0.2 Date: 2001-05-29 This document details Python-specific additions to and interpretations of the base `reStructuredText Markup Specification`_, part of the reStructuredText_ project, in the context of the `Python Docstring Processing System`_. ---------------- Syntax Details ---------------- For definitive element hierarchy details, see the "Python Plaintext Document Interface DTD" XML document type definition, ppdi.dtd_ (which modifies the generic gpdi.dtd_). Descriptions below list 'DTD elements' (XML 'generic identifiers') corresponding to syntax constructs. Option Lists ============ DTD elements: option_list, option_list_item, option, short_option, long_option, option_argument, description. Option lists are two-column lists of command-line options and descriptions. There are two types of options: short and long. Short options consist of one dash and an option letter. Long options consist of two dashes and an option word. Both short and long options may be followed by a single space and an argument placeholder. An option list item may have multiple command-line options listed, separated by comma-space. There must be at least two spaces between the option(s) and the description. The description may contain multiple body elements. As with other types of lists, blank lines are required before the first option list item and after the last, but are optional between option entries. For example:: -a Output all -b Output both (this description is quite long) -c arg Output just arg. --long Output all day long. -2, --two This option has two variants. -p This option has two paragraphs in the description. This is the first. This is the second. Doctest Blocks ============== DTD element: doctest_block. Doctest blocks are interactive Python sessions cut-and-pasted into docstrings. They are meant to illustrate usage by example, and provide an elegant and powerful testing environment via the doctest module in the Python standard library. Doctest blocks are text blocks which begin with '>>> ', the Python interactive interpreter main prompt, and end with a blank line. Doctest blocks are treated as a special case of literal blocks, without requiring the literal block syntax. If both are present, the literal block syntax takes priority over Doctest block syntax:: This is an ordinary paragraph. >>> print 'this is a Doctest block' this is a Doctest block The following is a literal block:: >>> This is not recognized as a doctest block by reStructuredText. It *will* be recognized by the doctest module, though! Indentation is not required for doctest blocks. Interpreted Text ================ DTD elements: package, module, class, method, function, module_attribute, class_attribute, instance_attribute, variable, parameter, type, exception_class, warning_class. In Python docstrings, interpreted text is used to classify and mark up program identifiers, such as the names of variables, functions, classes, and modules. If the identifier alone is given, its role is inferred implicitly according to the Python namespace lookup rules. For functions and methods (even when dynamically assigned), parentheses ('()') may be included:: This function uses `another()` to do its work. For class, instance and module attributes, dotted identifiers are used when necessary:: class Keeper(Storer): """ Extend `Storer`. Class attribute `instances` keeps track of the number of `Keeper` objects instantiated. """ instances = 0 """How many `Keeper` objects are there?""" def __init__(self): """ Extend `Storer.__init__()` to keep track of instances. Keep count in `self.instances` and data in `self.data`. """ Storer.__init__(self) self.instances += 1 self.data = [] """Store data in a list, most recent last.""" def storedata(self, data): """ Extend `Storer.storedata()`; append new `data` to a list (in `self.data`). """ self.data = data To classify identifiers explicitly, the role is given along with the identifier in either prefix or suffix form:: Use `method: Keeper.storedata` to store the object's data in the `Keeper.data :instance attribute`. The role may be one of 'package', 'module', 'class', 'method', 'function', 'module attribute', 'moduleatt', 'class attribute', 'classatt', 'instance attribute', 'instanceatt', 'variable', 'parameter', 'type', 'exception', or 'warning'. Other roles may be defined. .. _reStructuredText Markup Specification: http://structuredtext.sf.net/spec/reStructuredText.txt .. _reStructuredText: http://structuredtext.sf.net .. _Python Docstring Processing System: http://docstring.sf.net .. _ppdi.dtd: http://docstring.sf.net/spec/ppdi.dtd .. _gpdi.dtd: http://docstring.sf.net/spec/gpdi.dtd From dgoodger@bigfoot.com Sun Jun 3 18:36:12 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sun, 03 Jun 2001 13:36:12 -0400 Subject: [Doc-SIG] Re: doc PEPs In-Reply-To: <930BBCA4CEBBD411BE6500508BB3328F2E1ED3@nsamcanms1.ca.baltimore.com> Message-ID: [cc'ing to Doc-SIG] Hi Greg, on 2001-06-03 12:09, Greg Wilson (Greg.Wilson@baltimore.com) wrote: > Thanks for writing up your PEPs --- as someone > who teaches Python on a semi-regular basis, I've long wanted > more structure in the internal docs. I think it's a very common wish. > One question, though: > there have been proposals to replace or augment doc strings > with doc dicts, so that if the first item in a module or > function is an unassigned dict, its key/value pairs would > become the item's docs. I didn't see this possibility in > your PEPs --- have you considered it? No, I hadn't considered it. Off the top of my head I see some problems with "docdicts" (it's always easier to think up negatives than positives ;): 1. Dictionaries have no order. How would we know which entry goes where? 2. Runtime pollution. Do we need to access these extra docs at runtime? If not, why use up the space? 3. Ambiguity. Would you overload __doc__, or add a new __docdict__? The runtime pollution issue is circumvented by "additional docstrings" because they're discarded by the bytecode compiler. That may also be the case with literal dictionary expressions; I haven't checked. > Do you think it would be worth including discussion of it? Sure, if you or anyone else has enough interest to write up a proposal (addressing at least those issues I brought up above), I'd be happy to include it. I can't say that I see the usefulness of it though. Perhaps an example? If you have any links to earlier discussions, I'd like to take a look. Thanks for the feedback. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From klm@digicool.com Sun Jun 3 21:59:13 2001 From: klm@digicool.com (Ken Manheimer) Date: Sun, 3 Jun 2001 16:59:13 -0400 (EDT) Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: Message-ID: I have to say, at first blush this looks very nice to me. Lots of attractive (functionally *and* aesthetically) features - and darn comprehensive! (I would miss indentation as the cue for section depth nesting when _reading_ stx source - i find it more clear even than in the formatted presentation - but i guess for most people it's an unacceptable burden to _write_ by that rule. So be it.) I'll be interested to hear how it sits with others (especially those who've invested effort refining their stx sensibilities - tony, edward?) I like it. Ken Manheimer klm@digicool.com From doughellmann@bigfoot.com Sun Jun 3 23:48:14 2001 From: doughellmann@bigfoot.com (Doug Hellmann) Date: Sun, 3 Jun 2001 18:48:14 -0400 Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: References: Message-ID: <01060318481400.13920@branagan> On Sunday 03 June 2001 16:59, Ken Manheimer wrote: > I'll be interested to hear how it sits with others (especially those > who've invested effort refining their stx sensibilities - tony, > edward?) I like it. I would also miss using indention to denote subordinate paragraphs, but eliminating it might actually be a good idea. We have a rather large zwiki at work now, and most users are able to get the output to look reasonable with StructuredText. Since some renderers don't carry the indention through to the output, it occasionally confuses a less experienced user that *they* have to indent, but their pages don't come out that way. I'm a bit confused (after only a single reading) by the 'some text'_ formatting that looks prevalent here. Are those internal references to anchors within the document? It looks a bit, um, maybe dirty is the word, I don't know. What about using [] or {}? Maybe I'm just bothered that the single trailing or preceding _ is unbalanced. I'll read through again and see if a second pass makes this more clear to me. Doug From castor@snafu.de Mon Jun 4 02:45:20 2001 From: castor@snafu.de (castor@snafu.de) Date: Mon, 4 Jun 2001 01:45:20 MET Subject: [Doc-SIG] Re: StructuredText Markup Specification Message-ID: >The character set available in plain text documents, 7-bit ASCII, is >limited. So it is! But, who on earth, wants to keep up seven bits as a standard? Python processes Unicode, what kind of editors to you want to keep compatible with? vi? notepad? edlin? Wouldn't it be about time that *they* change? From Juergen Hermann" Message-ID: On Mon, 4 Jun 2001 01:45:20 MET, castor@snafu.de wrote: >>The character set available in plain text documents, 7-bit ASCII, is >>limited. > >So it is! But, who on earth, wants to keep up seven bits as a >standard? Plain text means Latin-1 here. Any limitation to USASCII would not be acceptable. Ciao, J=FCrgen From edloper@gradient.cis.upenn.edu Mon Jun 4 18:35:07 2001 From: edloper@gradient.cis.upenn.edu (Edward D. Loper) Date: Mon, 04 Jun 2001 13:35:07 EDT Subject: [Doc-SIG] Documentation markup & processing Message-ID: <200106041735.f54HZ7m09890@gradient.cis.upenn.edu> Hi all. Sorry I've been pretty quiet over the last month or so.. Real life got the better of me. I do want to get back into actively working on docstrings, now that the semester is over. I'm at a conference on computational linguistics right now, so I won't have a lot of time to look over everything David said.. At first glance, it looks pretty good. The one thing that worries me somewhat is that David threw a lot of stuff at the group all at once.. I think we should try to address one concern at a time, to the extent possible. In that spirit, I think David's idea of creating an overall framework, that divides the problem into formatters, processing tools, etc., is a very good idea. And I think that we can informally "ratify" such a framework without a pep, to help guide the efforts of those active on the doc-sig. Of course, we might then turn it into a pep, and get the official stamp of approval, etc. But I think that one major problem with the doc-sig newsgroup in the past has been that we try to solve everything at once, and don't concentrate enough on individual problems.. So, I think that in the near-term, we should try to focus on coming to a consensus on what the DPS should look like. I won't really have time to look over that pep and its DTDs for the next few days, but I'll try to get to it by the weekend. Some open questions, in my mind, are: - What pieces should we split the problem into? The most obvious pieces are parsers and outputters. Are there subproblems that can be well-defined (we would need to be able to define precise interfaces). - What should be/needs to be specified by the DPS beyond the interfaces? For example, it looked like David's PEPs specified that the DPS should never parse private member docstrings. But this might be very useful to do sometimes. I agree that this would be a reasonable default, but I don't think it should be a requirement.. Put a different way, where do we want to draw the line between "API issues" and "tool issues"? I would argue that *what* gets documented is a tool issue. - What's the best way to encode the APIs? My first instincts were to use XML and DOM. But I'm not sure that that's the best way to go. The reason I say that is because I've implemented by doc system using DOM for some intermediate representations, and it can be very inconvenient. I think that the only reason to use DOM is if we expect the interfaces to change, either during our discussions, or down the road.. Once (if?) we want to fix the interfaces, I think we should just make a module/package that encodes them with classes. That module/package could optionally be capable of reading/writing XML. - It seems like we should be paying a lot of attention to the two DTDs that David has on sf, because those will place strong constraints on what parsers *can* do, and on what outputers *have* to handle. I think that both DTDs have to be very well documented before we can accept them.. At the very least, we need definitions of the semantics of each element. I'm not sure that everyone would be happy with the DTDs in their current state. - How stable do we intentd to make the DTDs/interface? Once more than one or two tools use them, it becomes pretty expensive to change them -- every tool/parser must be modified. When I get a chance, I'll try to print out the DTDs and go over them carefully. I would really appreciate it if David (or anyone else) would try to add some documentation directly discussing the DTDs (or maybe it's there and I just missed it -- I only skimmed the PEPs). I think that optimally, the sig should address the following issues, roughly in order: 1. Define exactly what the DPS does. This needs to include what interfaces exist, but does not need to give full specifications of the interfaces. It should include things like where docstrings can appear, whether we really want to require parsing the source file (that excludes C modules), etc. 2. Define the interfaces, one at a time. Currently, there's really just one interface: between parsers and outputters. If we decide that we want more, define those too. 2a. Agree, at least on the sig, that we like the DPS, and we intend to work within its framework. 3. People can independantly work on their favorite parser, with active discussion on the sig about what they should look like. 4. People can trade their parsers, we can decide what we like or don't about them, and try to come to some consensus on what we want to keep and what we don't. 5. Same for outputters, or any other units we define (can occur in parallel with 3-4). But I think it's important to make sure that we don't get too distracted by 3-5 while working on 1-2. I think that getting 1-2 done well will have a pretty big impact on whether we eventually come up with results or not. -Edward p.s., David, I'll send you URLs by the end of the week, so you can include some of my work in your peps. :) From dgoodger@bigfoot.com Tue Jun 5 03:51:56 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Mon, 04 Jun 2001 22:51:56 -0400 Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: <01060318481400.13920@branagan> Message-ID: on 2001-06-03 18:48, Doug Hellmann (doughellmann@bigfoot.com) wrote: > I'm a bit confused (after only a single reading) by the 'some text'_ > formatting that looks prevalent here. It's actually `some text`_ (backquotes, chr(96), not straight quotes). Yes, I know, in some fonts they're indistinguishable. I submit that it's irrelevant that it's so, even elegant. To the reader, they look like quotes, which is what they're doing. Now, if you're *writing* or *editing* docstrings in code, your font had better distinguish between *all* characters. > Are those internal references to anchors within the document? Yes. The trailing underscore is the hyperlink reference-indicator. The quotes are necessary to group the space-separated words together as a 'phrase-link'; otherwise, only the last word would be considered the link name. > It looks a bit, um, maybe dirty is the word, I > don't know. What about using [] or {}? Actually, the first draft of the spec (you've just read the second draft) used square brackets for phrase-links. They're OK, but more prominent than backquotes. I changed my mind because: 1. I had already decided on single-backquotes for inline literal text. 2. However, I wanted to minimize the necessity for backslash escapes, for example when quoting Python repr-equivalent syntax that uses backquotes. 3. The processing of identifiers (funtion/method/attribute/module/etc. names) into hyperlinks is a useful feature. PyDoc recognizes identifiers heuristically, but it doesn't take much imagination to come up with counter-examples where PyDoc's heuristics would result in embarassing failure. I wanted to do it deterministically, and that called for syntax. I called this construct 'interpreted text'. 4. #2, combined with the *emphasis*/**strong** syntax, lead to the idea of using double-backquotes as syntax. 5. I worked out some rules for inline markup recognition. 6. Double backquotes in combination with #5 minimizes backslash escapes, so that lends itself to inline literals. In fact, the spec says that no interpretation of any kind is done within double-backquote inline literal text; backslashes do *no* escaping within literal text. 7. Single backquo;tes are then freed up for interpreted text. 8. I already had square brackets required for footnote references. 9. Since interpreted text will typically turn into hyperlinks, it was a natural fit to use backquotes as the phrase-quoting syntax for trailing-underscore hyperlinks. By the way, the trailing underscore syntax comes from Setext. For phrases it used underscores_between_words_like_this_, including the trailing underscore. > Maybe I'm just bothered that the > single trailing or preceding _ is unbalanced. I see the underscores as if they were right-pointing arrows: '-->'. So 'hyperlink_' points away from the reference, and '.. _hyperlink' points toward the target. > I'll read through again and > see if a second pass makes this more clear to me. Please do; I look forward to your comments. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Tue Jun 5 04:48:19 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Mon, 04 Jun 2001 23:48:19 -0400 Subject: [Doc-SIG] Documentation markup & processing Message-ID: Mon, 04 Jun 2001 13:35:07 EDT on 2001-06-04, Edward D. Loper (edloper@gradient.cis.upenn.edu) wrote: > The one thing that worries me somewhat is that David threw a > lot of stuff at the group all at once. Yes. I was working on refining reStructuredText (RST for short) when the idea of the Docstring Processing System (DPS) framework arose. RST was pretty much done and DPS was far enough along to release for feedback and (hopefully) contributions. RST depends on DPS, and RST is an example of a DPS component. So it made sense to release them simultaneously. Apologies for the overload! > I think we should try to > address one concern at a time, to the extent possible. Agreed. I especially don't want the two projects to influence each other. > In that spirit, I think David's idea of creating an overall framework, > that divides the problem into formatters, processing tools, etc., is a > very good idea. And I think that we can informally "ratify" such a > framework without a pep, to help guide the efforts of those active on > the doc-sig. Of course, we might then turn it into a pep, and get the > official stamp of approval, etc. The PEP process starts with a proposal, which is what I've written. Whether or not it gets approved is up to us; first the PEP has to be completed, and a reference implementation too. But the existence of the PEP gives us a focus, a baseline document to work from and on, to approve or reject. > - What pieces should we split the problem into? The most obvious > pieces are parsers and outputters. Are there subproblems that can > be well-defined (we would need to be able to define precise > interfaces). Ones that come to mind are the docstring extraction machinery (especially if additional & attribute docstrings are okayed), and the output management (the file/directory structure, and the output data structure when called for). I'm sure there will be more. > - What should be/needs to be specified by the DPS beyond the > interfaces? For example, it looked like David's PEPs specified > that the DPS should never parse private member docstrings. But > this might be very useful to do sometimes. Let's make it an option. The default would be to respect __all__ and private members, with a "give me everything" option. > Put a different way, where do we want to draw the > line between "API issues" and "tool issues"? I would argue that > *what* gets documented is a tool issue. Agreed. > - What's the best way to encode the APIs? My first instincts were > to use XML and DOM. ... But I'm not sure that that's the best way to > go. The reason I say that is because I've implemented by doc > system using DOM for some intermediate representations, and it can > be very inconvenient. I'd be interested to hear why. The DOM is what I've put down for an internal intermediate data structure, part of the API. DOM is there, doesn't need to be written. It suits the task at hand: a tree-hierarchy of objects with attributes and text contents. Why reinvent the wheel? > I think that the only reason to use DOM is > if we expect the interfaces to change, either during our > discussions, or down the road. I think we can depend on change. > - It seems like we should be paying a lot of attention to the two > DTDs that David has on sf, because those will place strong > constraints on what parsers *can* do, and on what outputers *have* > to handle. One idea not in the PEPs yet is how formatters should handle unimplemented elements. Given a reasonable solution (I don't know what it is yet), formatters could implement a subset of the elements, and gradually grow to completion. > I think that both DTDs have to be very well documented > before we can accept them. At the very least, we need > definitions of the semantics of each element. I'm not sure that > everyone would be happy with the DTDs in their current state. I agree completely, and I intend to do more documentation of the DTDs. I invite and welcome questions & criticism. > I think that optimally, the sig should address the following issues, > roughly in order: The DPS Generic Implementation Details PEP deals with #1 and #2. It's nowhere near complete yet; I just wanted to get it out there. > 1. Define exactly what the DPS does. ... > > 2. Define the interfaces, one at a time. Currently, there's really > just one interface: between parsers and outputters. I see several interfaces, actually. The parser->DPS interface, the DPS->formatter interface, the internal intermediate data structure (shared by parser, DPS, and formatter), the system Python interface (for when using the DPS as a package from other code), and the command-line interface. > 2a. Agree, at least on the sig, that we like the DPS, and we intend > to work within its framework. :-) > p.s., David, I'll send you URLs by the end of the week, so you can > include some of my work in your peps. :) Yes, please; and I will. Thanks for your preliminary comments. I look forward to more once you've had time to go through it all. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From tony@lsl.co.uk Tue Jun 5 10:47:48 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Tue, 5 Jun 2001 10:47:48 +0100 Subject: [Doc-SIG] Documentation markup & processing In-Reply-To: <200106041735.f54HZ7m09890@gradient.cis.upenn.edu> Message-ID: <00c101c0eda4$9437fad0$f05aa8c0@lslp7o.int.lsl.co.uk> Gosh - lots of stuff to read. I've also been very quiet on the list - it's been a change not to be hacking Doc-SIG stuff, and I've had other things to do (lots of learning XML related technologies, for a start). Plus we've just had a week's holiday (school holidays, spent relaxing in Ibiza). I'll read David's stuff over the next few days, but my initial impressions are good. I'll be interested to see what Edward Loper has to say (I've still to read *his* email in detail and think about it, too, but my initial impressions are "me too"). (BTW, I am truly impressed by the amount of text in the PEPs and other documents - since one of the problems of doing a PEP is producing "justification", and there's a *lot* of that needed for this, this is not insignificant work). Tibs, feeling encouraged -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "How fleeting are all human passions compared with the massive continuity of ducks." - Dorothy L. Sayers, "Gaudy Night" My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From frederic.giacometti@arakne.com Tue Jun 5 23:32:44 2001 From: frederic.giacometti@arakne.com (Frederic Giacometti) Date: Tue, 05 Jun 2001 18:32:44 -0400 Subject: [Doc-SIG] Re: [Types-sig] Re: documenting Python constraints on types References: Message-ID: <3B1D5E0C.5FC4CB0@arakne.com> Tim Peters wrote: > > I guess some further definition and formalizing work is required > > for the basic Python types / protocol. > > Have you looked at Paul Prescod's recent work here? Unfortunately, the > Types-SIG home page doesn't seem to have a reference to it. Paul? No, I'm not aware of it. Could Tim could give a reference to it ? > > > Here is a step forward: > > In the same spirit as in the read-only / writable Mapping, you may > > define: > > > > - "Tuple" (as a non-mutable read-only sequence > > Is that enough? Sometimes the distinction of interest is that it's-- unlike > all tuples --immutable "all the way down". It is consistent with Python; and defining 'immutability all the way down' is a Grail guest; you'll never be able to contain all possible side effects with Python, and then you'll have missed some. Besides, personnally, I see minor practical need for it, too. In any way, Tuple type need to be specified, since Tuple is a major Python type, and you can't get around without it. > This is akin to the distinction > the hash() builtin makes: not all tuples are hashable. This is a "shallow > vs deep" thing, e.g. (1, 2, 3) vs (1, [2], 3). We *call* both of those > "immutable" today, but the value of the latter (as seen by "==") may > actually change over time. Doing hashing with tuple as key is something fairly rare (for instance, you might want to count these situations in Python standard lib...). The case would have to be documented as an extra in the function/method definition. [[ Actually, in all practical cases of hashable tuples I know of, the type of each Tuple item is specified, so the problem does not occur there... Ex: (String, Int, Int) is a hashable tuple; no problem. ]] But let me remind the spirit of the thing: Make it fit the most common cases, the few other cases will require additional documentation. That makes sense to me :)) I'd rather have something that works in 80% of the cases, than nothing at all as it is presently the case. I'm not looking for any Grail; I'm just being practical :)) > > > - "Vector" (items can be changed, but the sequence size is > > frozen, just like in a vector objec > What's "a vector object" ? What does PyNumerical works with, for instance? It says it: <>; just like a C array.... A 3D vector of Floats can be specified as Vector( 3)[ Float], or as [Float, Float, Float]. Anybody normally connected understands such a notation (I hope :)). > > - List (anything can be done on it; modifying items, adding/removing > > items; just like a plain list). > > Including, e.g., list.sort()? You have to be very specific -- I'm afraid > "just like" is never adequate, as different people read different things > into any gap in precision. Well, we have to start from something, don't we? :)) We're no God who can create from nothing :)) Again, I'd rather start from a loose definition and narrow it down, that not do anything by fear of not getting it right the first time :))) (that's RAD, incremental quality improvement, small steps, U-name-it). Given that I know that I will never be 'perfectly specific', I'll be looking forward to being 'more and more specific'... Personally, I'd keep the sort() method outside (not required), and explicitely document it whenever it is required. Again, this is used in only a very small minority of functions. FG From castor@snafu.de Wed Jun 6 10:46:27 2001 From: castor@snafu.de (Wolfgang Lipp) Date: Wed, 6 Jun 2001 09:46:27 MET Subject: [Doc-SIG] Re: reStructuredText Markup Specification Message-ID: Intro On Sun, 03 Jun 2001 10:34:24 -0400, David Goodger wrote: > For section structure, indentation > is unnatural and awkward. First of all, I would like to say that I find David's proposal overwhelming for both its comprehensiveness and its length. Pretty much everything that might be covered is indeed mentioned, up to the coverage of DOM. However, I would like to object strongly to the advertised abolition of indention to indicate document structure. In this posting, I would like to motivate with a hopefully appropriate example and a following in-detail discussion that all of David's fears concerning structure-by- indention, with one small caveat, are not substantial in my view. Structure-by-Indention A Valid Generalization In contradiction to what David says, I find indent[at]ion natural and elegant, an appropriate and innovative means to express structure both in the application to programming language sources and to text markup. Moreover, the principle of hierarchical-structure-through-indention is applicable to a third domain, namely, to structured, 'non-binary' data files. In other words, there is a chance not only to produce a standard for the limited use of docstrings, there is definitely a chance to set up a framework in which the sources of: (1) the programming language, (2a) its inline documentation and (2b) other information materials, as well as (3a) configurational files and (3b) databases(*) are interpretable. (*) as far as 'binary' formats are not deemed to be more appropriate for some purposes; but think of mid-sized address collections etc., where non- binary, user-editable formats are definitely a big plus. At first, this appears to be a gargantuan task, given the volume of the docstring proposals alone. It may also seem to be off-topic to mention configuration files when documentation is discussed. However, the distinction between a structured database, a configuration file and a documentation is a rather superficial one: in all cases we have sequences of values that are (optionally) given names, where values in themselves may be either 'terminal' (eg, signify simple numbers or sequences of characters) or in turn contain more names with associated values: a name, therefore, may refer either to a single value or an arbitrarily deeply nested sequence of names and values. In a language like Python, the source symbolizes sequences of statements and expressions; again, where one entire group of statements is dependent on one single statement, indention is used to convey the scope of this dependency. Structure-by-Indention vs. Structure-by-"Style" Missing important generalizations at key junctures of a developing process may proof to be very expensive in the long run. As a case in point, let's have a look at the one most popular configuration file format to date, the 'ini' format; this consists of unordered list of items, followed by equal signs and optionally divided into non- hierarchical sections indicated by bracketed names, such as: [Bolts] foo = 42 bar0 = 3 bar1 = 4 [LeversTypeA] foo = 84 outer_x = 10 outer_y = 12 inner_x = 8 inner_y = 8 [LeversTypeB] foo = 92 It is easy to see that the specification of the 'ini' format fails to recognize 'sequences' and 'structures'. It is, therefore, very clumsy to express these concepts, when the need arises, in this format; commonly, the sketched kind of kludges (numbered and compound names) are used as workarounds. A revised version along the lines of Python syntax and the original StructuredText proposal painlessly removes these shortcomings (beta implementation available as 'pylon.xcfg'; as an option, one could consider to make trailing '=' obligatory at the end of lines that start a block): Bolts foo = 42 bar # or, "bar = (3,4)" 3 4 Levers TypeA foo = 84 outer x = 10 y = 12 inner x = 8 y = 8 TypeB foo = 92 A structure like this patterns quite naturally to Python's mappings and lists. It is also easy to see that the structure thus indicated is in principle neither different from a Python script, nor from a text with paragraphs and headings. Now, it is very simple to copy, for example, the section 'Levers.TypeA.outer' to another place, even to another structural level, say 'Bolts'. You will then have to change indention; in case you forget that, either something ungrammatical or something with a different meaning will result. However, such a mistake would in this case be only of local impact (ie., the place where the problem is recognized is the place where the problem actually occurs; also, one can delineate the offending construct and could choose to skip in in processing): Bolts foo = 42 bar = (3,4) outer # ungrammatical indention x = 10 y = 12 [...] (Of course, the ungrammaticality stems from certain assumptions made; a syntax where the above construct would yield, for example, '{'bar':{ 'NN':(3,4), 'outer':{...} }, 'NN' being a default name, is also conceivable). However, in David's proposal, the same structure would look something like this (please correct me): ====== Bolts ====== foo = 42 bar = 3,4 # or something like this ====== Levers ====== TypeA ----- foo = 84 outer ..... x = 10 y = 12 inner ..... x = 8 y = 8 TypeB ----- foo = 92 Now, people, please excuse me! but you do not want me or anyone to believe that this is a clearer, more obvious, 'self-documenting', more maintainable format, do you? Does anyone honestly think this gets *any* better only because documentation has typically *more* material between section headings? Next, consider what happens when you want to copy Levers.TypeA.outer to Bolts: ====== Bolts ====== [...] outer -+ ----- | <---+ x = 10 | | y = 12 -+ | | | ====== | Levers | ====== | [...] | | outer -+ | ..... +-----+ x = 10 | y = 12 -+ To me, it is completely non-obvious that the markup of element 'outer' has to change from one arbitrary style (dotted) to another arbitrary style (dashed). Nothing in these styles indicates their hierarchical meaning. Also, in case I forget to change that markup, I do not get an error anywhere near the offending line -- since markups ar determined ad-hoc by precedent, it may in fact be the *following* section that looks ungrammatical. This kind of markup is difficult to understand and hard to maintain. Refutation I would now like to detail my objections against the reasons David put forth to show the unfitness of indention as a means to indicate structure in natural-language texts. Quoting David's posting (see the end of this message for the original), these reasons are: (1) Using indentation is [u]nnatural (1a) Most published works use title style (type size, face, weight, and position) and/or section/subsection numbering rather than indentation to indicate hierarchy. When indentation is used, it is usually the formatted end-result and is there for aesthetic rather than structural purposes. (1b) [T]he style of the section title should indicate its structure. [...] In fact, [section structure through title style] is already in widespread use in plain text documents, including in Python's standard distribution (such as the toplevel README_ file). (2) Using indentation is [a]wkward. (2a) One must think about the formatting as the text is keyed in. (2b) And when structural changes are made (it is very common during the composition of a document to rearrange sections and their hierarchy) we must use block-indent and -unindent functions. (2c) In order to edit documents using indentation, relatively advanced text editors must be used. (3) Applying indentation to ordinary written text is hypergeneralization. Following are my objections. 1: Indention Unnatural? Indention is 'natural' -- that's why C programmers use it although they don't have it, that's why GvR chose indention for Python although he didn't have to. Indention is a typographical device that came into widespread use at least with the spread of the typewriter, and what are plain text editors but software typewriters? It is a near-no-no *not* to use indention in *some* places, even in places where other typographical means of expression *are* available (verse, quotes, mottos, abstracts...), or where it is redundant (unindented code is almost tantamount to obfuscated code). It is interesting to see that David's proposal *does* keep indention for these cases: * lists * term definitions * literal blocks ... more? Therefore, indention is indeed highly 'natural' and also 'appropriate'. I try to show this in the discussion of almost every single question in this posting. True, it may be painful in cases where you must use an editor that is weak on this point. Above, I even wrote a list of two integers in indented style; most of the time a list notation would be clearer (short items: parentheses -- long items: indention). For this and other reasons, it may be worthwhile to consider a syntax that allows both indention and other means (such as parentheses) to indicate document structure, so both are always available options. (Python, of course, uses parentheses for mappings, lists, and tuples, but indentions for classes, functions, etc.; here, both means are used, but not interchangeably so). 1a: Published Works Don't Do It, Let's Do It As stated above, professionally typeset and published materials do in some cases use indention, but mostly not for the use of indicating section structure. However, 'real' typography, as David notes, too, has means that are simply not available in a 'typewriter' situation. And, when you open a book, you will see that it is, in fact, not only the size and position of titles that matter -- it is also the space given to them: Chapters often commence only on uneven pages, leaving an entirely blank page to their left, sections have a considerable amount of space above and some more below them. Granted, we also meet with the occasional embellishment here and there, which may take on the shape of a line. However, David's argument in itself is a bit of a problem because it is claimed that we users of editors should mimick them typographers in their ways (and shun indention, because, you see, in books they don't use it either), while it is at the same time acknowledged that we lack the means to do so (we don't have big type, so let's use underline). This is contradictory. Secondly, it is stated that indention "is usually the formatted end-result and is there for aesthetic rather than structural purposes" -- well, it seems to me that David's underlined section headings are rather 'aesthetically' than 'structurally' motivated, at least when compared to indention. Also, it is a little bit of a folly to throw in the concept of 'aesthetic' at this point of the discussion and expect people to understand this to be a kind of a bug, a failure, a misunderstanding, a faulty approach to consider 'aesthetic' aspects when what you really wanted was clarifying 'structure'. If those books with their typesizes and empty spaces were not 'aesthetic', who would read them? If our design of typeset text were not 'aesthetic', could we even manage to write them? If not about the 'aesthetics', what else is it that we talk about here? If aesthetics are 'out', I guess then parentheses are 'in': indention is not the easiest to parse, so why bother? It is precisely 'aesthetics' and almost nothing but 'aesthetics' that we talk about here. This is a 99% pure 'aesthetics' discussion, the rest being feasibility (in Python code). It is not 'practical', not from the computer's point of view, to have scripting languages -- that's a mere fuzz, a waste of CPU cycles. No computer 'writes' documentation, no computer cares about the look of documents, drafted or printed. It is us who is doing this, and what we are looking for is a practical, manageable, readable and pleasing way of doing the job, in other words, we are looking for a beautiful solution of the problem. However, the proposed solution for over- and underlined section titles, while it may have some visual appeal (that a line put into a comment would also lend), misses to fulfill the promise that is a practical means (demonstrated when we tried copying elements in the last section). We surprisingly also lack the technical means to conveniently manage over- and underlining of headlines, as I try to show in point (2c), below. So, typographers don't do it (well, not all of the time), but they have other means. We are programmers and documentation authors, working on software typewriters, so let's do it. 2: Indention Awkward? Indention is elegant. Trying to convince Python people of the elegance of indention is unnecessary, they're already convinced of this. It should be hard for a programmer to accept a scheme that is purportedly 'natural' in its indication of 'structure' when it uses arbitrary, highly context-sensitive and ambiguous lines instead of (any or all of) indention, parentheses, begin-end-commands, i.e. those means that are, for a programmer, the most logical choices. 2a: Think While You Type? David, no. You are with your text when you write it, are you? And what, please, is the application of a proper (and arbitrary) line style but an activity that necessitates a certain amount of awareness? I reject this point. 2b: Structural Changes Difficult? The main points to be made here have already been discussed in the previous section, entitled 'Structure-by-Indention vs. Structure-by-"Style"'. Let me add here that I consider it as one of the vices -- or omittances - of HTML and most markup schemes that authors are forced to indicate all section levels explicitly. As David says, the writing of a document is a process where many changes even in the structure of a document are made. But how often does the author, who for some reason tackel their source with a plain editor, has to go through all those tags, exchanging all the numbers in all the tags, twice for every heading, upon finding an unsatisfactory structuring of the document! Of how little help all the advanced regular expression replacement tools are in this case! How big the surprise on finding out that with the new- fangled docstring format they will find themselves at very much the same impasse again! How much would he love to even use M$W*rd, if only for the outline view! Outline view with symbolic indention! Isn't this cornerstone software of the evil WYZYWYG empire one of the most unlikely places in the universe to find concrete indention being replaced by abstract, symbolic indention? But it works, and it's easy: change structure, no problem, drag, drop, all formats cared for. Indention is the single trick that allows users with plain text editors to prove they're no dummies when it comes to restructuring. David complains about having to change the indention all the time. But this is a feature, not a bug. It is well intended that the level of the section is *not* written down. It is done due to the insight that a subsection is not different from a subsubsection: the latter only happens to be at a structurally deeper level than thee former. Accordingly, in indented text, what you do in order to *move* the level is you *move* the text. So much for the 'Indention Is Unnatural' argument. If someone thinks one must have concrete, absolute section levels, and there may be situations where they are advantageous, please make a proposal that shows the user section levels and not twiggly vs. dotted vs. dashed single and double lines. I suggested elsewhere to introduce proper commands (I find the 'directives' of the proposal wholly unsatisfactory, especially in the context of a scripting language), and I used double semicolons for the demonstration. Therefore, one could use ;;h My Title The body of the section goes into subsequent blocks. ;;h Another Title The body of the subsection goes into subsequent blocks. for relative heading-body pairs and ;;h3 My Title The body of the section goes into subsequent blocks. ;;h+1 Another Title The body of the subsection goes into subsequent blocks. for absolute and relative, explicit markups. Additionally, again as stated elsewhere, I think it is advantageous and more systematical to introduce explicit, if somewhat lengthy, extensible, self- explaining commands and only then associate these, as far as there is need and mutual agreement, with typographic situations ("Single line, no punctuation at end, followed be indented blocks" and so on). This kind of procedure gives authors much more orientation and feature-safety. 2c: Indention-Capable Software Not Available? In point (2c), David says that one "must use block- indent and -unindent functions[, features of] relatively advanced text editors". Well, at least we *do* have *some* editors that have functionality to perform the indenting and undenting of groups of lines -- can anyone name a text editor that has a similar functionality to perform underlining? Can anyone, please, point out a text editor that does all of these: * do *both* over- *and* underlining, * keep track of the characters in over- and underlining being the same, * keep both over- and underline at the same length, * keep both over- and underline at least as long as the right edge of the intervening title. I do not know any editor with any of these capabilities (or 'awarenesses'). Sure, you can write an Emacs macro to do that, but then, Emacs is exactly that kind of "relatively advanced" software that David does not want to be forced to use (nor do I). Moreover, if indention is only available in "relatively advanced text editors", as David observes, then, please! where is the editor, apart from Emacs, that supports the proposed table format? I only know a very few that support a 'line drawing mode' (ie, moving the cursor leaves a line as trace; linestyles, intersections etc.), but that is a very far cry from being able to draw (or manage) *tables*. I for sure am one who, as a reader, would definitely enjoy more readable tabular data in plain text. As an author, however, I am loathe to find myself being obliged to use Emacs (and I know the program) only because that's the only software in the world that knows how to decently handle ASCII tables (as an *optional* format I can, of course, only welcome the proposal for tables). It is not quite clear to me how to sell this: First, the well-established device of indention is more or less (but not entirely) thrown out, partly on the grounds that current text editors are purportedly not able to handle it (or perhaps make it difficult to use "block- indent and -unindent functions" -- I use the tab key for that purpose). Then, a format for section headings is suggested that current editing software is plainly ignorant about. Next, a table format is introduced that in 99% of all editors turns out plain hell as soon as a single cell has to change size (try it once). This argumentation fails to convince me. (3) Indention A Valid Generalization I contend that indention is a valid generalization to indicated structure of a given text. It is precisely the generalization expressable by indention that is missing in, for example, HTML: In HTML, you put one heading into the text, then a paragraph, then another heading, again followed by a paragraph. While this in itself suffices to indicate the structure, it is not quite obvious why, in another case, both list items, which are members (dependants) of a list, and the list itself are made structurally explicit. Clearly, this difference in treatment is unjustified, although practical reasons may be found. In theory, an HTML markup should (and, syntactically, could) look something like this:
My Title

The body of the section goes into subsequent blocks.

Another Title

The body of the subsection goes into subsequent blocks.

Of course, this is sort of a markup-overkill for the weathered indentionist. The drawback of the HTML view is simply that the structure of the markup is not as congruent with the conceptual structure of a document as would be possible. Conceptually, a chapter 'has' a 'heading' and 'contains' 'text', which in turn may be divided into 'sections' and so on. In HTML, however, a 'heading' has a 'level' and 'precedes' a 'text', and perhaps another 'heading' of another 'level'. In the first view, it is *level* that follows from the structure, while in the second, it is the *structure* that must be deduced from the 'levels'. This, indeed, is a rather decisive difference. According to David's proposal, docstrings would suffer from the same lack of sound generalization, with all difficulties, as HTML documents. One More Remark, A Caveat And Conclusion Apart from the treatment of indention in the proposal, I also have some doubts abouts the fitness of the proposed markups for definition lists (number 8 of the proposal) and literal blocks (number 9). In the first case, the proposed markup appears somehow too volatile to me, in the second, it is quite arbitrary. Again, wouldn't we be better off with markup to signify 'commands' or 'role indicators'? Then, taking ';;' for the purpose of demonstration, we could have ;;glossary foo A subspecies of gnu. doo-foo Mythical animal; a winged foo. rants Wide-eyed geckoes. as well as ;;lit Literally, a line. It is, then, still possible to associate more unobstrusive, less explicit formatting characteristics with these or other data formats; however, that choice would be much more configurable and explicit than the procedures presently proposed. I think it is more promising to make an extensible, explicit scheme and then allow shortcuts to those features than to bind some non- explicit markup early in the decision process to some very specific purpose. (BTW, is there a distinction between 'literal' segments and 'code' segments? That would be important for coloring and formatting). Now for the caveat announced above. Yes, the proposal is right, those underlines do somehow stick out, I admit that. But, isn't that more appropriately effected with a line of dashes in a comment within the docstring? Since lines of dashes and the like would then be free again I suggest that a concrete markup is used for horzontal rulers. HRs are very practical in long texts, although typographs and web design advisors discourage their use (but those people don't deal with long-running, single- page technical documentation). And what markup could be more suggestive than lines made up of whitespace plus nothing but repetitions of any one of these characters: '-.,;:_#+*~'(etc.). Concluding, I urge everybody not to abolish indention. That wouldn't be very Python, I'm afraid. Wolfgang Lipp castor@snafu.de lipp@epost.de full quote: >3. Structure via Indentation >============================ >Setext_ required that body text be indented by 2 spaces. The original >StructuredText_ and StructuredTextNG_ require that section structure be >indicated through indentation, as "inspired by Python". For certain >structures (outlines, lists, literal blocks, block quotes) indentation >naturally indicates structure or hierarchy. For section structure, >indentation is unnatural and awkward. Rather, the style of the section >title should indicate its structure. >In the original StructuredText, sections consist of one-line title >paragraphs followed by indented paragraphs and other body elements. Using >indentation is: >- Unnatural. Most published works use title style (type size, face, weight, > and position) and/or section/subsection numbering rather than indentation > to indicate hierarchy. When indentation is used, it is usually the > formatted end-result and is there for aesthetic rather than structural > purposes. >- Awkward. One must think about the formatting as the text is keyed in. And > when structural changes are made (it is very common during the > composition of a document to rearrange sections and their hierarchy) we > must use block-indent and -unindent functions. In order to edit documents > using indentation, relatively advanced text editors must be used. >Python's significant whitespace is a wonderful innovation (even if not >original to Python), however applying indentation to ordinary written text >is hypergeneralization. >reStructuredText_ indicates section structure through title style (as >exemplified by this document). This is far more natural. In fact, it is >already in widespread use in plain text documents, including in Python's >standard distribution (such as the toplevel README_ file). From dgoodger@bigfoot.com Thu Jun 7 05:55:04 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Thu, 07 Jun 2001 00:55:04 -0400 Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: Message-ID: Wolfgang, You make some good points (perhaps a little heavy on the hyperbole? ;-). I'd like to take some time to consider your position and compose my reply. Let me assure you though that I don't intend to abolish indentation. Challenge it, propose and implement an alternative, yes. The whole point of the DPS is that there doesn't have to be one and only one way. The result of competition could be the survival of the fittest, or amicable coexistence, or cross-pollination, I don't know. But it would be good to have competition. /David From castor@snafu.de Thu Jun 7 11:29:14 2001 From: castor@snafu.de (castor@snafu.de) Date: Thu, 7 Jun 2001 10:29:14 MET Subject: [Doc-SIG] Re: reStructuredText Markup Specification Message-ID: >You make some good points (perhaps a little heavy on the hyperbole? ;-). I'd >like to take some time to consider your position and compose my reply. Admittedly there's some hyperbole to it... but then... It's just that I do think indention is a Good Thing, that's it. The underline stuff is in fact more readable *locally* (did I omit that in my posting?), that is, when you have one heading plus a few lines and then some. Globally, however, and when more than two heading levels come into play, I think indention is more readable (and more reliable). >Let me assure you though that I don't intend to abolish indentation. >Challenge it, propose and implement an alternative, yes. The whole point of >the DPS is that there doesn't have to be one and only one way. The result of >competition could be the survival of the fittest, or amicable coexistence, >or cross-pollination, I don't know. But it would be good to have >competition. A day later, perhaps the main point on my side is about procedure, and that means to me that we should build a down-to-earth format, something "like python", that might even look clumsy to some people, something with a boring, but steadfast syntax. That done, let's talk about "situations" or "textual constellations", in one and in two dimensions, about character classes and so forth. Then, alternative interpretations of situations can be used as shortcut to features, replacing "eloquent" markup with a more "symbolic" or "iconic" one. Such shortcuts would be configurable at least to the extent that a developer can clearly delineate what is markup and what is core, perhaps to the extent that a user can choose among several "formats" or write their own (even if for the special purpose of docstrings, one or a few specific "format" definitions will have to be prescribed). The shortcuts could always be discarded, backing up to the "eloquent" markup would be possible. This way, we can make features available before we actually decide on a specific "iconic" notation for it. Then, I can test e.g. hyperlinks, references and annotations with (inventing a syntax) Please $$a{$$href{http://xy.com}click here}. As discussed in $$ref{BLOCH}, gnus have four legs.$$note{most of the time, at least.} and so on, and perhaps if someone comes up with nice iconic replacements for some of these thingies, sometime later the same would be expressable as (again blindly inventing something) Please ***http://xy.com click here***. As discussed in [[BLOCH]], gnus have four legs.$$note{most of the time, at least.} In the above, some features have been shortcut, and they happily co-exist with eloquent markup for those cases that have perhaps not yet received an alternative representation, or not ones that the author happens to like. On a slightly bigger scale, such a mechanism could even alow for the coexistence of under/overlining style and indention style for section heading. -wolf From castor@snafu.de Thu Jun 7 11:29:33 2001 From: castor@snafu.de (castor@snafu.de) Date: Thu, 7 Jun 2001 10:29:33 MET Subject: [Doc-SIG] Re: reStructuredText Markup Specification Message-ID: >You make some good points (perhaps a little heavy on the hyperbole? ;-). I'd >like to take some time to consider your position and compose my reply. Admittedly there's some hyperbole to it... but then... It's just that I do think indention is a Good Thing, that's it. The underline stuff is in fact more readable *locally* (did I omit that in my posting?), that is, when you have one heading plus a few lines and then some. Globally, however, and when more than two heading levels come into play, I think indention is more readable (and more reliable) (and theoretically more pleasing, at that). >Let me assure you though that I don't intend to abolish indentation. >Challenge it, propose and implement an alternative, yes. The whole point of >the DPS is that there doesn't have to be one and only one way. The result of >competition could be the survival of the fittest, or amicable coexistence, >or cross-pollination, I don't know. But it would be good to have >competition. A day later, perhaps the main point on my side is about procedure, and that means to me that we should build a down-to-earth format, something "like python", that might even look clumsy to some people, something with a boring, but steadfast syntax. That done, let's talk about "situations" or "textual constellations", in one and in two dimensions, about character classes and so forth. Then, alternative interpretations of situations can be used as shortcut to features, replacing "eloquent" markup with a more "symbolic" or "iconic" one. Such shortcuts would be configurable at least to the extent that a developer can clearly delineate what is markup and what is core, perhaps to the extent that a user can choose among several "formats" or write their own (even if for the special purpose of docstrings, one or a few specific "format" definitions will have to be prescribed). The shortcuts could always be discarded, backing up to the "eloquent" markup would be possible. This way, we can make features available before we actually decide on a specific "iconic" notation for it. Then, I can test e.g. hyperlinks, references and annotations with (inventing a syntax) Please $$a{$$href{http://xy.com}click here}. As discussed in $$ref{BLOCH}, gnus have four legs.$$note{most of the time, at least.} and so on, and perhaps if someone comes up with nice iconic replacements for some of these thingies, sometime later the same would be expressable as (again blindly inventing something) Please ***http://xy.com click here***. As discussed in [[BLOCH]], gnus have four legs.$$note{most of the time, at least.} In the above, some features have been shortcut, and they happily co-exist with eloquent markup for those cases that have perhaps not yet received an alternative representation, or not ones that the author happens to like. On a slightly bigger scale, such a mechanism could even alow for the coexistence of under/overlining style and indention style for section heading. -wolf From castor@snafu.de Thu Jun 7 12:22:12 2001 From: castor@snafu.de (castor@snafu.de) Date: Thu, 7 Jun 2001 11:22:12 MET Subject: [Doc-SIG] MBI -- Might Be Interesting Message-ID: readers, today I was pointed out an interesting project from the world of, uhm, serialization- cum-indention? ok, seriously, this is a project to define a human-readable (and -writeable) data format that tries to closely follow established standards in data exchange and in scripting languages. on first look, it looks a little bit perlish, but, then, not very so; its use of significant indention makes it in the end rather pythonesque. pls. have a look at it, it's relevant: http://yaml.org/ cheers, -wolf ps. i am not quite sure, is it perlish or perlesque, or does that depend on context and attitude? -w From Edward Welbourne Thu Jun 7 20:04:35 2001 From: Edward Welbourne (Edward Welbourne) Date: Thu, 7 Jun 2001 20:04:35 +0100 (BST) Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: (message from Wolfgang Lipp on Wed, 6 Jun 2001 09:46:27 MET) References: Message-ID: Indentation is *the* pythonic way to express structure. I already know which depth of indentation is shallower/deeper of two. I shall have to learn which (over- and) under-line style means what. I cannot forget which depth of indentation is which. I shall forget which of ====, ----, ...., ____ etc is shallower/deeper. I shall forget which of them go before-and-after the title, which only after. I can indent some more if I need to, no matter how indented I already am. How many line-styles shall we define ? Indentation is natural. Folk use it in e-mails without any agreed format, and use it in consistently intelligible ways. All my doc-strings use indentation already; and in my web pages I use BlockQuote to indent asides, proofs and other subordinate material relative to the main text; not just for aesthetic purposes, but equally for the structural purpose of indicating its status as a subordinate text. When I wrote, for our testing engineer, a specification of what HTTP content negotiation does, I was writing a singularly complex logical proposition (when the functionality is enabled and the resource requested is absent, if there are resources whose names differ therefrom only in the addition of suffixes to which ...) so guess what - I expressed its structure (on a whiteboard) by using: indentation. That made it easier for Philip to keep track of its structure. I do not believe one can draw any kind of a crisp boundary between aesthetic and practical values in documentation: if the text does not guide the eye to the information, it fails in its function; giving such guidance to the eye is aesthetics. Since not only programs but also folk read code, I apply the same reasoning to code. Putting a marker under or over a text looks ugly to me: albeit largely because vertical space is precious to me and such a marker squanders a whole line (or two). Indentation stands out at least as clearly as such a line: and makes it easy for me to see the structural truth - I can see, directly, where the indented chunk starts and ends. With line-styles, I have to not only know precedence order of line-styles but also scan through the text looking for lines of `a given style or shallower'; this is an error-prone activity. When a section's title tells me enough that I'm going to skip the section - and all its subsections - I don't want to have to scan that section, all the same, in search of the header line which will end it - I want my eye lead rapidly and unambiguously to the section's end, with as little risk as possible of missing the next section. If I (over- and) under-line a heading with the style two levels deeper than the most recent heading, it's `wrong'. If I indent by twice as much as usual, it has aesthetic effect in the source; but is logically one step deeper. Wolfgang's points about moving a chunk of structure are good. I find his case compelling. How could a pythoneer not ? Eddy. From Juergen Hermann" Message-ID: On Thu, 7 Jun 2001 11:22:12 MET, castor@snafu.de wrote: >ps. i am not quite sure, is it perlish or perlesque, >or does that depend on context and attitude? It's "evil". :)) From tim.one@home.com Sun Jun 10 06:22:05 2001 From: tim.one@home.com (Tim Peters) Date: Sun, 10 Jun 2001 01:22:05 -0400 Subject: [Doc-SIG] RE: [Types-sig] Re: documenting Python constraints on types In-Reply-To: <3B1D5E0C.5FC4CB0@arakne.com> Message-ID: [Frederic Giacometti] >>> I guess some further definition and formalizing work is required >>> for the basic Python types / protocol. [Tim] >> Have you looked at Paul Prescod's recent work here? Unfortunately, the >> Types-SIG home page doesn't seem to have a reference to it. Paul? [Frederic] > No, I'm not aware of it. > Could Tim could give a reference to it ? I delayed replying hoping to find enough time to search the list archives, but it looks like I'm never going to get to that. Paul, you there? I believe your work here was very much in tune what Frederic is looking for. From rbill@digisprings.com Sun Jun 10 20:16:03 2001 From: rbill@digisprings.com (Robert W. Bill) Date: Sun, 10 Jun 2001 14:16:03 -0500 (CDT) Subject: [Doc-SIG] Jython documentation Message-ID: Hello all, The jython users list has recently embraced documentation. There's no shortage of Python or Java documentation, but Jython's niche is a bit sparse. Mending this brought up the issue of documentation standards. This really is leading up to questions... Collecting information and examples in a Wiki seemed a good first step, but the formal documentation wasn't so clear. Note that the type of documentation we are pursuing is not that gleaned directly from Java or Python code (not inline). Almost to the questions... The Latex documentation espoused by Fred Drake's "Documenting Python" wasn't a big hit as few are drawn to Latex; however, staying close to CPython's documentation seemed a good idea. The section on the documentation future (sgml, xml) seems more interesting. And finally, the questions... What sgml, xml tools are used by the documentation group? The current doc projects seemed more aimed at using inline documenation- are there tools for executive level (not inline) docs? Are there Python doc specific DTD's that should be considered, or is DocBook the most reasonable, despite weighty, path? Is there other advice we can benefit from? Thanks in advance. Cheers, Robert From fdrake@acm.org Mon Jun 11 15:31:47 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Mon, 11 Jun 2001 10:31:47 -0400 (EDT) Subject: [Doc-SIG] Jython documentation In-Reply-To: References: Message-ID: <15140.54867.460026.911780@cj42289-a.reston1.va.home.com> Robert W. Bill writes: > Collecting information and examples in a Wiki seemed a good > first step, but the formal documentation wasn't so > clear. Note that the type of documentation we are pursuing > is not that gleaned directly from Java or Python code (not I guess my biggest question is: What kind of content are you thinking about? Are there problems with using the standard documentation? Would the addition of compatibility notes help, or is there something more significant lacking? > The Latex documentation espoused by Fred Drake's "Documenting > Python" wasn't a big hit as few are drawn to Latex; however, > staying close to CPython's documentation seemed a good idea. LaTeX isn't that big a hit anywhere! ;-) > The section on the documentation future (sgml, xml) seems more > interesting. And finally, the questions... I need to work on that some more; the target will definately be XML. > What sgml, xml tools are used by the documentation group? The > current doc projects seemed more aimed at using inline > documenation- are there tools for executive level (not inline) > docs? Are there Python doc specific DTD's that should be > considered, or is DocBook the most reasonable, despite weighty, > path? Is there other advice we can benefit from? I've considered DocBook at the object-oriented extensions that have been proposed, and it just isn't a good match. I have on my plate working up the DTD(s?) and related data/content model documentation, but have not had the time yet. ;( Tool-wise, its too early to be very specific. I intend to stick with standards-based tools and Python (though I won't restrict myself to tools written in Python). I expect to see a bunch of Python and some XSLT, and no Perl, but once I've got the DTD(s?) and models documented, it should be (relatively) easy to apply any general XML tools. I have no specific timeframe because it just isn't that high a priority with my employer. -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From matt@clondiag.com Mon Jun 11 16:57:08 2001 From: matt@clondiag.com (Matthias Kirst) Date: Mon, 11 Jun 2001 17:57:08 +0200 Subject: [Doc-SIG] HTTPS Message-ID: <006601c0f28f$2b568730$3701a8c0@silberpfeil> This is a multi-part message in MIME format. ------=_NextPart_000_0063_01C0F29F.EED7B610 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I compiled the socket - module with the https - option. Is there any documentation for the httplib.HTTPS class ? Thank you, Mattias Kirst CCT ------=_NextPart_000_0063_01C0F29F.EED7B610 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
I compiled the socket - module with the = https -=20 option.
Is there any documentation for the = httplib.HTTPS=20 class ?
 
Thank you,
 
Mattias Kirst
CCT
------=_NextPart_000_0063_01C0F29F.EED7B610-- From fdrake@acm.org Mon Jun 11 17:10:12 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Mon, 11 Jun 2001 12:10:12 -0400 (EDT) Subject: [Doc-SIG] HTTPS In-Reply-To: <006601c0f28f$2b568730$3701a8c0@silberpfeil> References: <006601c0f28f$2b568730$3701a8c0@silberpfeil> Message-ID: <15140.60772.729376.880659@cj42289-a.reston1.va.home.com> Matthias Kirst writes: > I compiled the socket - module with the https - option. > Is there any documentation for the httplib.HTTPS class ? No, but if anyone writes some, I'd love to add it to the standard documentation. -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From rbill@digisprings.com Mon Jun 11 17:30:01 2001 From: rbill@digisprings.com (Robert W. Bill) Date: Mon, 11 Jun 2001 11:30:01 -0500 (CDT) Subject: [Doc-SIG] Jython documentation In-Reply-To: <15140.54867.460026.911780@cj42289-a.reston1.va.home.com> Message-ID: On Mon, 11 Jun 2001, Fred L. Drake, Jr. wrote: > Robert W. Bill writes: > > Collecting information and examples in a Wiki seemed a good > > first step, but the formal documentation wasn't so > > clear. Note that the type of documentation we are pursuing > > is not that gleaned directly from Java or Python code (not > > I guess my biggest question is: What kind of content are you > thinking about? The first-draft outline is at: http://www.jython.org/cgi-bin/moin.cgi/JythonDevelDocs > Are there problems with using the standard documentation? Do you mean referencing Python docs, or using the standard doc (LaTeX) tools? Standard docs are already referenced and are valuable, but do not address the union with Java and what that means. > Would the addition of compatibility notes help, or is > there something more significant lacking? There are quite a few notes concerning differences between Jython and Python. However, the scope of the documentation glut includes working with Java objects, embedding in Java, the role of reflection, compiling to Java bytecode, inheritance restrictions, work-arounds for java static, protected members, Jython registry keys, Java class loading and other such topics unique to Jython. There seems to be a sizable niche between Java and Python. We're anxious hear recommendations on how to best fill this, but the outline mentioned above is our starting point. > > The Latex documentation espoused by Fred Drake's "Documenting > > Python" wasn't a big hit as few are drawn to Latex; however, > > staying close to CPython's documentation seemed a good idea. > > LaTeX isn't that big a hit anywhere! ;-) > > > The section on the documentation future (sgml, xml) seems more > > interesting. And finally, the questions... > > I need to work on that some more; the target will definately be > XML. > > > What sgml, xml tools are used by the documentation group? The > > current doc projects seemed more aimed at using inline > > documenation- are there tools for executive level (not inline) > > docs? Are there Python doc specific DTD's that should be > > considered, or is DocBook the most reasonable, despite weighty, > > path? Is there other advice we can benefit from? > > I've considered DocBook at the object-oriented extensions that have > been proposed, and it just isn't a good match. I have on my plate > working up the DTD(s?) and related data/content model documentation, > but have not had the time yet. ;( > Tool-wise, its too early to be very specific. I intend to stick > with standards-based tools and Python (though I won't restrict myself > to tools written in Python). I expect to see a bunch of Python and > some XSLT, and no Perl, but once I've got the DTD(s?) and models > documented, it should be (relatively) easy to apply any general XML > tools. > I have no specific timeframe because it just isn't that high a > priority with my employer. > > -Fred It sounds best for us to stick to the Wiki until there's time to make a DTD. Thanks for the reply. Cheers, Robert From fdrake@cj42289-a.reston1.va.home.com Mon Jun 11 20:15:06 2001 From: fdrake@cj42289-a.reston1.va.home.com (Fred Drake) Date: Mon, 11 Jun 2001 15:15:06 -0400 (EDT) Subject: [Doc-SIG] [development doc updates] Message-ID: <20010611191506.DC49F28923@cj42289-a.reston1.va.home.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Substantial additional material on floating point arithmetic in the tutorial, written by Tim Peters to explain why FP can fail to reflect the decimal world presented to the user. Lots of additional updates and corrections. From skip@pobox.com (Skip Montanaro) Mon Jun 11 21:20:33 2001 From: skip@pobox.com (Skip Montanaro) (Skip Montanaro) Date: Mon, 11 Jun 2001 15:20:33 -0500 Subject: [Doc-SIG] Feedback on new floating point info in tutorial In-Reply-To: <20010611191506.DC49F28923@cj42289-a.reston1.va.home.com> References: <20010611191506.DC49F28923@cj42289-a.reston1.va.home.com> Message-ID: <15141.10257.487549.196538@beluga.mojam.com> Fred> Substantial additional material on floating point arithmetic in Fred> the tutorial, written by Tim Peters to explain why FP can fail to Fred> reflect the decimal world presented to the user. I took a quick look at that appendix. One thing that confused me a bit was that if 0.1 is approximated by something ever-so-slightly larger than 0.1, how is it that if you add ten of them together you wind up with a result that is ever-so-slightly less than 1.0? I didn't expect it to be exactly 1.0. Other floating point naifs may be confused in the same way: >>> "%.55f" % 0.5 '0.5000000000000000000000000000000000000000000000000000000' >>> "%.55f" % 0.1 '0.1000000000000000055511151231257827021181583404541015625' >>> "%.55f" % (0.5+0.1) '0.5999999999999999777955395074968691915273666381835937500' I guess the explanation is that not only can't most decimals be represented exactly, but that summing the same approximation multiple times doesn't always skew the error in the same direction either: >>> "%.55f" % (0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1) '0.7999999999999999333866185224906075745820999145507812500' >>> "%.55f" % (0.8) '0.8000000000000000444089209850062616169452667236328125000' IEEE-754-is-full-of-traps-for-the-unwary-ly y'rs, Skip From tim.one@home.com Tue Jun 12 03:17:24 2001 From: tim.one@home.com (Tim Peters) Date: Mon, 11 Jun 2001 22:17:24 -0400 Subject: [Doc-SIG] RE: [Python-Dev] Feedback on new floating point info in tutorial In-Reply-To: <15141.10257.487549.196538@beluga.mojam.com> Message-ID: [Skip Montanaro, on the in-progess 2.2 Tutorial appendix] > I took a quick look at that appendix. One thing that confused me > a bit was that if 0.1 is approximated by something ever-so-slightly > larger than 0.1, how is it that if you add ten of them together you > wind up with a result that is ever-so-slightly less than 1.0? Good for you, Skip! In all the years I've been explaining this stuff, I only recall one other picking up on that immediately. I'm not writing a book here, though , and any intro numeric programming text emphasizes that n*x is a better bet than adding x together n times. >>> .1 * 10 1.0 >>> Greg Ewing put you on the right track, if you want to figure it out yourself (as Deep Throat said, "follow the bits, Skip -- follow the bits"). > I didn't expect it to be exactly 1.0. Other floating point naifs > may be confused in the same way: > > >>> "%.55f" % 0.5 > '0.5000000000000000000000000000000000000000000000000000000' > >>> "%.55f" % 0.1 > '0.1000000000000000055511151231257827021181583404541015625' > >>> "%.55f" % (0.5+0.1) > '0.5999999999999999777955395074968691915273666381835937500' Note that this output is platform-dependent. For example, the last on Windows is >>> "%.55f" % (0.5+0.1) '0.5999999999999999800000000000000000000000000000000000000' > ... > IEEE-754-is-full-of-traps-for-the-unwary-ly y'rs, All computer arithmetic is; and among binary fp systems, 754 has got to be the best-behaved there is. Know how many irksome bugs I've fixed in Python mucking with different sizes of integers across platforms, and what C does and doesn't guarantee about them? About 20x more than fp bugs. Of course there's 10000x as much integer code in Python too . god-created-the-integers-from-1-through-3-inclusive-and-that's-it-ly y'rs - tim From dgoodger@bigfoot.com Wed Jun 13 05:23:50 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Wed, 13 Jun 2001 00:23:50 -0400 Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: Message-ID: on 2001-06-07 15:04, Edward Welbourne (eddy@vortigen.demon.co.uk) wrote: > Indentation is *the* pythonic way to express structure. Indentation is *the* pythonic way to express *program* structure. But we're discussing prose, not Python. Outlines use indentation, but prose text rarely does. > I shall forget which of ====, ----, ...., ____ etc is shallower/deeper. > I shall forget which of them go before-and-after the title, which only after. > > I can indent some more if I need to, no matter how indented I already am. > How many line-styles shall we define ? As many as the author likes. If you read the section on section structure again, you'll see that the number, styles, and order of section titles is taken from the document and not prescribed by the spec. All that is required is that they be consistent. > If I (over- and) under-line a heading with the style two levels deeper > than the most recent heading, it's `wrong'. If I indent by twice as > much as usual, it has aesthetic effect in the source; but is logically > one step deeper. It's just as easy to make an indentation error:: Title of Section 1 Text of section 1. Title of Section 2 Text of section 2. Title of Section 3 Text of section 3. If the beginning of sections 1 and 2 are not visible when viewing the beginning of section 3, it's very easy to make a mistake like the above. I have a big problem with the structure as expressed by the sections above (even without the error). The titles are indistinguishable from the text! > Wolfgang's points about moving a chunk of structure are good. > I find his case compelling. > > How could a pythoneer not ? Python also has classes, methods, and functions to describe program structure. These are not applicable to prose either. Apples and oranges. But I'm just arguing for argument's sake. Before replying, please see my proposal on indented sections (2 posts from now). -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Wed Jun 13 05:26:15 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Wed, 13 Jun 2001 00:26:15 -0400 Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: Message-ID: I will address some of Wolfgang's points (the relevant ones :-) here, then propose a compromise solution in another post. on 2001-06-06 05:46, Wolfgang Lipp (castor@snafu.de) wrote: > In other words, there is a chance not only to produce a > standard for the limited use of docstrings, there is > definitely a chance to set up a framework in which the > sources of: (1) the programming language, (2a) its inline > documentation and (2b) other information materials, as > well as (3a) configurational files and (3b) databases(*) > are interpretable. All reStructuredText addresses is 2a, inline documentation, and possibly 2b, if that meant documentation in general, as in standalone files. Any references to types 1, 3a & 3b are irrelevant to the discussion, merely distractions. reStructuredText is what-you-see-is-what-you-get plaintext. That's challenge enough! > Next, consider what happens when you want to copy > Levers.TypeA.outer to Bolts: [example of erroneous editing of 'significant title adornment' sections, omitted] Yes, this is a significant issue, one where indentation definitely wins with current tools. > Following are my objections. > > 1: Indention Unnatural? ... > Therefore, indention is indeed highly 'natural' and > also 'appropriate'. Yes, indentation is natural and appropriate for structures with a very limited, local extent, such as lists, block quotes, and literal blocks. It is not natural for section structures which can span multiple pages or screenfuls. Imagine a textbook containing indented sections, say 4 levels deep (such textbooks do exist; can't think of any titles though). When you're on the fourth page of section 5.4.3.2, how does indentation help? It doesn't. Of course, 'significant title adornment' sections are the same. It's a non-starter; neither wins out. > However, David's argument in itself is a bit of a > problem because it is claimed that we users of editors > should mimick them typographers in their ways (and > shun indention, because, you see, in books they don't > use it either), while it is at the same time > acknowledged that we lack the means to do so (we don't > have big type, so let's use underline). This is > contradictory. It's not "let's mimic the typographers," it's "let's distinguish the titles somehow." Indentation alone isn't enough; it's used for too many other things. Typographers use heavy display type for titles because it jumps out at you. They use boldface and italics in running text for the same reason. In plaintext we have neither. For inline emphasis, Setext chose **various** _styles_ `_of_` ~emphasis~; for reStructuredText I chose a coherent, self-consistent and unambiguous subset. reStructuredText uses underlining to distinguish the titles, to make the title text stand out. > Secondly, it is stated that indention "is usually the > formatted end-result and is there for aesthetic rather > than structural purposes" -- well, it seems to me that > David's underlined section headings are rather > 'aesthetically' than 'structurally' motivated, at > least when compared to indention. Yes, the underlined titles are aesthetic. One interpretation of "aesthetic" is "parsable to the human eye and brain". The unadorned titles of indented StructuredText sections are not easily parsed by my eye, even though they may be no problem to software. They look like one-line paragraphs. Followed by indented blocks, sure, but where's the significance of that? What's the precedence? > It is us who is doing this, and what we are > looking for is a practical, manageable, readable and > pleasing way of doing the job, in other words, we are > looking for a beautiful solution of the problem. Yes. Beautiful == consistent and coherent and implementable. ['it' == 'indentation':] > So, typographers don't do it (well, not all of the > time), but they have other means. We are programmers > and documentation authors, working on software > typewriters, so let's do it. Not a convincing argument. I understand that many people like indented sections. Many don't. *I* don't, and I won't use them. But in order to come up with something everyone might agree on, I've devised a compromise. See my proposal post. > 2: Indention Awkward? > > Indention is elegant. Trying to convince Python people > of the elegance of indention is unnecessary, they're > already convinced of this. It should be hard for a > programmer to accept a scheme that is purportedly > 'natural' in its indication of 'structure' when it > uses arbitrary, highly context-sensitive and ambiguous > lines instead of (any or all of) indention, > parentheses, begin-end-commands, i.e. those means that > are, for a programmer, the most logical choices. This is not programming, this is prose. Different domains. I've tried to come up with a workable, coherent, parsable interpretation of what people do anyway. Like a text version of speech or handwriting recognition. You can only get people to alter or constrain their speech or handwriting patterns so far before they refuse to use the software (notable exception: Palm's Graffiti). Same with writing styles. StructuredText was beyond my usability threshold; reStructuredText is usable. > 2b: Structural Changes Difficult? > 2c: Indention-Capable Software Not Available? Enough oration! I get and accept the point. Again, please see my proposal post. (Do you realize that all this is in response to my original 35 lines in problems.txt? It's a 20-to-1 ratio! Include the 60 lines in the spec itself and it's still over 7-to-1. Obviously a serious concern! ;-) > Moreover, if indention is only available in > "relatively advanced text editors", as David observes, > then, please! where is the editor, apart from Emacs, > that supports the proposed table format? As I wrote at the beginning of the spec, "Less often-used constructs and extensions to the basic reStructuredText syntax may have more elaborate or explicit markup." Tables are a less-often-used construct, requiring more elaborate markup by their very nature. I came up with the syntax before I knew the Emacs table mode existed (I did a search in hopes it existed, *after* I came up with the syntax, and was pleasantly surprised). reStructuredText tables look like tables; that's one of the goals of the markup. Tables have nothing to do with 'indented sections' vs. 'significant title adornment sections'. > According to David's proposal, docstrings would suffer > from the same lack of sound generalization, with all > difficulties, as HTML documents. I'm not alone in refusing to use XML or YAML in docstrings. These kinds of markup are absolutely regular, but regular markup is unwieldy for authors to use. reStructuredText walks a very fine line; it's an attempt to find an ideal markup balance between regular and freeform. This is an argument that has been raised and shot down many times before. > One More Remark, A Caveat And Conclusion > > Apart from the treatment of indention in the proposal, I > also have some doubts abouts the fitness of the proposed > markups for definition lists (number 8 of the proposal) > and literal blocks (number 9). The numbers are not referring to the proposal itself (http://structuredtext.sf.net/spec/reStructuredText.txt), but to the analysis of StructuredText's problems (http://structuredtext.sf.net/spec/problems.txt). > In the first case, the > proposed markup appears somehow too volatile to me, in the > second, it is quite arbitrary. Definition list syntax: why volatile? It uses indentation! ;-) Literal blocks: the syntax comes from StructuredText, and it works. If they are unsatisfactory, please suggest alternatives (other than the following). > Again, wouldn't we be better off with markup to signify > 'commands' or 'role indicators'? That's been proposed and shot down before. However, reStructuredText *does* take exactly this approach with syntax extensions ('directives') and inline markup ('interpreted text'): explicit command/role names. But those are extensions, uncommon exceptions. Common constructs have implicit markup. reStructuredText is all about exploiting implicit markup to the fullest. You're free to propose and implement a command-based markup. In fact, please do! Less talk, more code! (Or at least a concrete proposal, please.) > (BTW, is there a distinction between 'literal' segments > and 'code' segments? That would be important for coloring > and formatting). There are literal blocks and Doctest blocks. The Doctest blocks are Python, and could be syntax-colored, but they are interactive Python sessions and not always applicable to showing code excerpts. Literal blocks *could* be examined for code content, and processed accordingly; that's a tools issue, not markup. Perhaps someone could suggest a syntax for Python blocks, where syntax coloring is the aim? Until there's an acceptable syntax, using a 'python' directive would suffice. > Now for the caveat announced above. Yes, the proposal is > right, those underlines do somehow stick out, I admit > that. But, isn't that more appropriately effected with a > line of dashes in a comment within the docstring? Yuck! I've included comments along with directives in reStructuredText because I know there will be a need for them, but to *force* authors to use comments? No thanks. And if you're saying, "use a comment if you *want* an underline, otherwise indentation alone is good enough", I disagree strongly. See my proposal post. > Since lines of dashes and the like would then be free > again I suggest that a concrete markup is used for > horzontal rulers. HRs would not be inconsistent with the rest of reStructuredText, nor difficult to parse. They are, however, purely presentational and HTML-centric. I'll add them to the "Notes" file, but not to the spec. What do others think? > Concluding, I urge everybody not to abolish indention. > That wouldn't be very Python, I'm afraid. If anybody wants to propose and implement an input parser that indicates structure purely with indentation (like YAML), please go ahead. Personally, *I* don't believe in it, and *I* wouldn't use it. But mine is just one voice. Thank you, Wolfgang, for the feedback. It's very useful in refining one's ideas. Next time, though, perhaps less personal invective? Coming up next: the proposal... -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Wed Jun 13 05:26:52 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Wed, 13 Jun 2001 00:26:52 -0400 Subject: [Doc-SIG] Proposal for indented sections in reStructuredText Message-ID: The vehement feedback from Wolfgang Lipp and Edward Welbourne, as well as the notes of regret from Ken Manheimer and Doug Hellmann, caused me to reflect on the real reasons why I reject how StructuredText uses indentation for sections. I then came up with a form of indented sections that I can live with, and I hope everyone else can too. The rejection rationale and proposed solution follow. Please let me know what you think. StructuredText states: "A single-line paragraph whose immediately succeeding paragraphs are lower level [indented] is treated as a header." Here's an example:: A text paragraph. A Section Title A text paragraph. There is very little to distinguish the title from the text paragraphs. Capitalization, and the lack of final punctuation, give us very subtle clues; neither is a requirement though. It could just as easily be:: A section title that looks like a text paragraph. A text paragraph. As can be seen from the examples above, StructuredText's headers are ambiguous and potentially surprising. PEPs get around this by requiring sections (and therefore titles and indentation) for all text. In other words, no paragraphs *can* start at column 1, so there's no ambiguity about the titles. Unfortunately, this also limits PEPs to one level of recognized sections. I write more hierarchically; my PEP 258 uses two levels of subsections. For the vast majority of docstrings and standalone documents which will potentially use reStructuredText, only one level of section structure is necessary. To force the author to use indentation for these documents is unnecessary and irritating. Having said all that, and in light of their popularity, I've reconsidered the value of indented sections. I propose that reStructuredText also allow entire sections (titles *and* section bodies) to be indented relative to their enclosing block. Title adornment (an underline and possibly an overline) will still be required, as well as overall consistency. Once a section is indented, all subsections must also be indented. Title adornment style usage must remain consistent. For example, here are three equivalent variations of a standalone document with a document title, three sections, and one subsection. Optional blank lines are omitted for brevity. 1. Unindented reStructuredText:: ================ Document Title ================ It is my business to know things. That is my trade. Introduction ============ All those moments, lost in time, like tears in rain. Main Body ========= Remember: no matter where you go, there you are. SubSection ---------- I don't remember yesterday. Today it rained. Conclusion ========== Nobody expects the Spanish Inquisition! 2. Indented subsection only:: Document Title ============== It is my business to know things. That is my trade. Introduction ------------ All those moments, lost in time, like tears in rain. Main Body --------- Remember: no matter where you go, there you are. SubSection ---------- I don't remember yesterday. Today it rained. Conclusion ---------- Nobody expects the Spanish Inquisition! 3. Fully indented, sections and subsection, with only one title adornment style:: Document Title -------------- It is my business to know things. That is my trade. Introduction ------------ All those moments, lost in time, like tears in rain. Main Body --------- Remember: no matter where you go, there you are. SubSection ---------- I don't remember yesterday. Today it rained. Conclusion ---------- Nobody expects the Spanish Inquisition! I examined and rejected the following variation, which is StructuredText with underlined titles:: Document Title -------------- It is my business to know things. That is my trade. Introduction ------------ All those moments, lost in time, like tears in rain. Main Body --------- Remember: no matter where you go, there you are. SubSection ---------- I don't remember yesterday. Today it rained. Conclusion ---------- Nobody expects the Spanish Inquisition! I rejected the variation above for two reasons: 1. It has section bodies indented relative to the titles, as if the bodies 'belong' to the titles and the titles are superior. This is contrary to the near-universal model which has titles and section bodies belonging to the section itself: titles and bodies are at an equal level. 2. Except for the document title, every line of a standalone document is indented. This is unacceptably wasteful and irritating. On reStructuredText's web site (http://structuredtext.sf.net/), I have modified my arguments in `Problems With StructuredText`_, removing the 'awkward' argument (both indentation and adornment are awkward) and adding 'unnecessary' and 'ambiguous' arguments. I have also modified the `reStructuredText Markup Specification`_ document. Please comment; your feedback is welcome. .. _Problems With StructuredText: http://structuredtext.sf.net/spec/problems.txt .. _ reStructuredText Markup Specification: http://structuredtext.sf.net/spec/reStructuredText.txt -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From pf@artcom-gmbh.de Wed Jun 13 07:21:16 2001 From: pf@artcom-gmbh.de (Peter Funk) Date: Wed, 13 Jun 2001 08:21:16 +0200 (MEST) Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: from David Goodger at "Jun 13, 2001 00:26:52 am" Message-ID: Hi David, Nice proposal: [...] > 3. Fully indented, sections and subsection, with only one title > adornment style:: > > Document Title > -------------- > > It is my business to know things. That is my trade. > > Introduction > ------------ > All those moments, lost in time, like tears in rain. > > Main Body > --------- > Remember: no matter where you go, there you are. > > SubSection > ---------- > I don't remember yesterday. Today it rained. > > Conclusion > ---------- > Nobody expects the Spanish Inquisition! I'm +1 on this variant. This is exactly what I had in my mind. Forget about the other variants: IMO they suck compared to this one. Of course in Python doc-strings the document title must be optional. Regards, Peter -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany) From lipp@epost.de Wed Jun 13 11:06:18 2001 From: lipp@epost.de (Wolfgang Lipp) Date: Wed, 13 Jun 2001 19:06:18 +0900 (Tokyo Standard Time) Subject: [Doc-SIG] Re: reStructuredText Markup Specification Message-ID: <3B248CCF00017E2B@mail.epost.de> (added by postmaster@mail.epost.de) > >It's just as easy to make an indentation error:: > > Title of Section 1 > > Text of section 1. > > Title of Section 2 > > Text of section 2. > > Title of Section 3 > > Text of section 3. > >If the beginning of sections 1 and 2 are not visible when viewing the >beginning of section 3, it's very easy to make a mistake like the above. > >I have a big problem with the structure as expressed by the sections above >(even without the error). The titles are indistinguishable from the text! > >Python also has classes, methods, and functions to describe program >structure. These are not applicable to prose either. Apples and oranges. > All of the above is true: (1) it is possible to make errors, even (almost) invisible ones (mixing spaces w/ tabs, using different tabsizes etc.). (2) In principle, nothing tells you the difference between a heading and a text -- in fact, a heading is text with a special function (and, yes, perhaps title case plus no dot at the end -- but how about questions as headlines?) (3) (Most) (prose) texts do not have classes, functions etc. (1) applies to other schemes as well, it is a very subjective factor. (2) I do suggest there be some 'unusual', 'clear', 'salient' additional markup to distinguish headlines from other blocks of text. I am not happy with relying on missing punction, or on headlines having to be one-liners. (3) True, but, we have end-of-being and radiation fallout, plus we have * headlines, * codeblocks, * block quotes, * tables, *illustrations(?), elements structured in themselves to appear in a text structured as * documents with * sections and perhaps *appendices. This is a potentially much richer structure than Python scripts typically have. Different though they are, prose and program structures still seem related. Functions are much like the subsections of a written law, or a term definition. Literature and programming are not so different to me... a good story or a play, like a program... -Wolf From guido@digicool.com Wed Jun 13 14:16:46 2001 From: guido@digicool.com (Guido van Rossum) Date: Wed, 13 Jun 2001 09:16:46 -0400 Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: Your message of "Wed, 13 Jun 2001 00:26:52 EDT." References: Message-ID: <200106131316.JAA11893@cj20424-a.reston1.va.home.com> I haven't been able to follow this, but I read David Goodger's clear post on this topic. I still think that using indentation to indicate sectioning is wrong. If you look at how real books and other print publications are laid out, you'll notice that indentation is used frequently, but mostly at the intra-section level. Indentation can be used to offset lists, tables, quotations, examples, and the like. (The argument that docstrings are different because they are input for a text formatter is wrong: the whole point is that they are also readable without processing.) I reject the argument that using indentation is Pythonic: text is not code, and different traditions and conventions hold. People have been presenting text for readability for over 30 centuries. Let's not innovate needlessly. I think allowing indented sections because it's popular is unpythonic: there should be only one way to do it. Existing ST should be run through a converter. --Guido van Rossum (home page: http://www.python.org/~guido/) From sam@ddmweb.com Wed Jun 13 21:45:16 2001 From: sam@ddmweb.com (Sam Penrose) Date: Wed, 13 Jun 2001 13:45:16 -0700 Subject: [Doc-SIG] Re: PEP 257: Docstring Conventions Message-ID: <01061313582203.05742@frock.ddmweb.com> >>> This is a PEP-ification of part of Guido van Rossum's Python Style Guide ... <<< parts of the Style Guide weather the conversion to a specification better than others. For example... "Insert a blank line before and after all docstrings (one-line or multi-line) that document a class -- generally speaking, the class's methods are separated from each other by a single blank line, and the docstring needs to be offset from the first method by a blank line; for symmetry, put a blank line between the class header and the docstring. Docstrings documenting functions generally don't have this requirement, unless the function's body is written as a number of blank-line separated sections -- in this case, treat the docstring as another section, and precede it with a blank line." ... seems a bit visually oriented for the purpose of making docstrings machine-parseable. I would prefer to see only things which further the (wonderful; hear hear!) goals of the doc-sig made into specifications. Which will require editing years-old BDFL pronouncements. Cheers, S From tony@lsl.co.uk Thu Jun 14 10:52:16 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 14 Jun 2001 10:52:16 +0100 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: <200106041735.f54HZ7m09890@gradient.cis.upenn.edu> Message-ID: <011501c0f4b7$b1e1c650$f05aa8c0@lslp7o.int.lsl.co.uk> I said I'd get round to commenting on David's documents (now formal PEPs - yeh!), and I still haven't had the time to read them thoroughly, let alone formulate proper comments. I *still* aim to do that, but here are some quick comments "to be going on with". 1. From a quick scan, I believe I could live with the results of this - i.e., I don't think there are any show-stoppers for me (I reserve the right to quibble later, of course, being a pedant). Given we've now got PEPs to work against, this is a relief to me, if not to anyone else (!). 2. Somewhere, I didn't notice it in my quick scan, it would be good to emphasise that the *primary* aim of this project is doc strings, which are *not* (meant to be) incredibly long. This means that constructs that only work well in long documents are not as important (they are a *nice thing*, but not the main reason for existence). 3. I believe (as discussed earlier) that we could drop **strong** emphasis - I think one form of emphasis is enough for almost all purposes, especially if there are problems nesting the two forms (which I know Edward Loper has worried about in the past). 4. There is a good description of how literal quoting works (i.e., what characters may be adjacent to the quotes). I think this argument should be extended to apply (suitably amended) to other forms of quoting as well - I assume in David's mind it does already, but in the document I browsed it wasn't explicit. 5. Did it mention whether line breaks were allowed in things? Should be no for literals, yes for other quoted thingies... 6. I prefer not to have indentation used for main structure in the documents - it isn't necessary in a docstring, and has locality problems in a LONG document. Luckily Guido agrees with me. Erm, no, that must be the other way round... 7. I *hate* the titles with "underlining" above as well as below - yuck. 8. What are the rules for how *many* "underlines" must be present for a title - the same number as the title, end at the same column as the end of the title, at least one... 9. DOM - my experience is that trying to use a DOM tree to do the work in leads to madness (I'll elucidate if anyone cares, but basically it's clearly too constraining). However, I still reckon that producing a DOM tree as final *output* is very useful. Thus one needs to provide method on the appropriate class(es) to emit a DOM tree - this is simple to do, and allows one to either publicisise or not the "working" class APIs. (useful hint: a method that takes a DOM node to "attach" the resultant DOM fragment to (as a child) works well - from that DOM node one can get to the document, and that provides the appropriate factory methods. It's a little naff, in some ways, to have a side-effect on the DOM tree in this way, but it works.) 10. Oh - terminology on ".." - don't refer to them as "comments", since "executable/meaningful comments" is an abomination. Refer to them as (for instance) directive delimiters, and note that an implementation may ignore undefined directives (which has an identical effect to what you've already described - although personally I'd prefer to get a warning - but is not horrible sounding). It's a good thing to avoid raising people's hackles if you don't have to... Sorry for the brevity, Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "How fleeting are all human passions compared with the massive continuity of ducks." - Dorothy L. Sayers, "Gaudy Night" My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From lipp@epost.de Thu Jun 14 11:43:53 2001 From: lipp@epost.de (Wolfgang Lipp) Date: Thu, 14 Jun 2001 19:43:53 +0900 (Tokyo Standard Time) Subject: [Doc-SIG] Proposal for indented sections in reStructuredText Message-ID: <3B248CCF00026564@mail.epost.de> (added by postmaster@mail.epost.de) Guido van Rossum wrote: >I reject the argument that using indentation is Pythonic: text is not >code, and different traditions and conventions hold. People have been >presenting text for readability for over 30 centuries. Let's not >innovate needlessly. > >I think allowing indented sections because it's popular is unpythonic: >there should be only one way to do it. Existing ST should be run >through a converter. Guido, isn't indentation in Python a needless invention, too? Programmers had gotten used to it as a redundant and semantically insignificant, potentially even misleading device. The real thing, for well over 3 decades, had been all curly and other braces, and 'begin'/'end' blocks. It would have been logical to come up with a language (or return to such languages) where indentation is considered ungrammatical. Instead, curly braces and 'begin's and 'end's for blocks fell prey to an innovative re-interpretation. Indentation has since lost its misleading character and proven to be a valid, readable and low-redundancy way to express structure in code text. Others have extended this concept to replace markups in prose text. No fully grammatical implementation has been worked out so far. Indented text is still in its inceptive stage with a, consequently, small user community. I understand from the second paragraph that indentation stands a chance only in so far as it is more popular than other devices to structure text. I agree. If a majority turns out to be in favour of a more liberal solution that allows more than one way, would that beat TSBOOWTDI, or is TSBOOWTDI even above that? -Wolf From guido@digicool.com Thu Jun 14 11:59:28 2001 From: guido@digicool.com (Guido van Rossum) Date: Thu, 14 Jun 2001 06:59:28 -0400 Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: Your message of "Thu, 14 Jun 2001 19:43:53 +0900." <3B248CCF00026564@mail.epost.de> (added by postmaster@mail.epost.de) References: <3B248CCF00026564@mail.epost.de> (added by postmaster@mail.epost.de) Message-ID: <200106141059.GAA25360@cj20424-a.reston1.va.home.com> > Guido van Rossum wrote: > >I reject the argument that using indentation is Pythonic: text is not > >code, and different traditions and conventions hold. People have been > >presenting text for readability for over 30 centuries. Let's not > >innovate needlessly. > > > >I think allowing indented sections because it's popular is unpythonic: > >there should be only one way to do it. Existing ST should be run > >through a converter. > > Guido, isn't indentation in Python a needless invention, too? > Programmers had gotten used to it as a redundant and semantically > insignificant, potentially even misleading device. The real thing, > for well over 3 decades, had been all curly and other braces, and > 'begin'/'end' blocks. It would have been logical to come up with a > language (or return to such languages) where indentation is considered > ungrammatical. Instead, curly braces and 'begin's and 'end's for blocks > fell prey to an innovative re-interpretation. Indentation has since > lost its misleading character and proven to be a valid, readable and > low-redundancy way to express structure in code text. Very funny, but not a reasonable argument. Presenting program source code has a history of about 50 years, and indentation has been part of the presentation tradition for about 40 of those. Plain text however, has been around for, oh, 30 centuries, and I am as skeptical of this "innovation" as I am of many other "improvements" to text presentation that have been proposed by computer geeks. Arguing the same point from the other direction, code has a much higher structure-to-text ration than text (even if that text is documentation for code), so the cost-benefits analysis comes out the other way. For text, the length of sections (often more than a page) mean that the human reader isn't very good at keeping track of indentation levels. I bet you've been confused once or twice in your life by a book where a significant indent coincided by a page break. So we scan for the section headers to discern the section structure. Given the way our brain works, indendation is best used for *small* structure, which abounds in code, and indeed it is used for small structure in text. My conclusion: using indentation to discern section structure in text would be as much giving in to the computer (which has no problem keeping track of indents over many pages) as is using braces to discern block structure in code. > Others have extended this concept to replace markups in prose text. No > fully grammatical implementation has been worked out so far. Indented > text is still in its inceptive stage with a, consequently, small user > community. > > I understand from the second paragraph that indentation stands a chance > only in so far as it is more popular than other devices to structure > text. I agree. If a majority turns out to be in favour of a more liberal > solution that allows more than one way, would that beat TSBOOWTDI, or is > TSBOOWTDI even above that? > > -Wolf Sure, but I would doubt a majority of votes in this forum, where geeks are overrepresented. --Guido van Rossum (home page: http://www.python.org/~guido/) From lipp@epost.de Thu Jun 14 13:39:49 2001 From: lipp@epost.de (Wolfgang Lipp) Date: Thu, 14 Jun 2001 21:39:49 +0900 (Tokyo Standard Time) Subject: [Doc-SIG] Re: reStructuredText Markup Specification Message-ID: <3B248CCF000274D4@mail.epost.de> (added by postmaster@mail.epost.de) Discarding some lines I had already written, I think it is more constructive to answer/continue on the lines of thoughts expressed by David (, Wed, 13 Jun 2001 00:26:52 -0400) and Peter (, Wed, 13 Jun 2001 08:21:16 +0200 (MEST)). David examines four alternatives, differing in character markup (underlines) and indentation. Currently, I'd much prefer the style discussed by David as number three (Peter, thanks for pointing out the demerits of the other variants ;-) -- but with a slight variation (the lines indicate the 'paper'): +--------------------------------- | (1) Documents may start right away at zero indention; no document title is required. *** Top level heading *** All text and headings of the same logical level receive the same amount of indent. *** Second level heading *** All text and headings of the same logical level receive the same amount of indent. *** Title of Section 3 *** All text and headings of the same logical level receive the same amount of indent. | +--------------------------------- (1) is structure-by-indentation style; it has an indentation-free alternative: +--------------------------------- | (2) Documents may start right away at zero indention; no document title is required. *** Top level heading *** All text and headings of the same logical level receive the same amount of indent. +++ Second level heading +++ All text and headings of the same logical level receive the same amount of indent. *** Title of Section 3 *** All text and headings of the same logical level receive the same amount of indent. | +--------------------------------- Since this is a liberal proposal, I would like to allow the mixed form as well: +--------------------------------- | (3) Documents may start right away at zero indention; no document title is required. *** Top level heading *** All text and headings of the same logical level receive the same amount of indent. +++ Second level heading +++ All text and headings of the same logical level receive the same amount of indent. *** Title of Section 3 *** All text and headings of the same logical level receive the same amount of indent. | +--------------------------------- and suggest to derive levels in the intermediate form from indentations and discard differences in the character markups (though strict-minded people would perhaps be right in suggesting that in such a case, indentations and character markups must be coherent within a document). The two styles do not conflict with each other. It might be wise to disallow mixing styles in a single docstring. The style is determined by comparing the first heading in the text with the closest heading that differs from the first in either character markup or indentation. Please compare all of the above with the readability of underlined headings, with identical text and spacing: +--------------------------------- | (4) Documents may start right away at zero indention; no document title is required. Top level heading ***************** All text and headings of the same logical level receive the same amount of indent. Second level heading ++++++++++++++++++++ All text and headings of the same logical level receive the same amount of indent. Title of Section 3 ****************** All text and headings of the same logical level receive the same amount of indent. | +--------------------------------- Given that -- in all of the above examples -- heading/body ratios are hardly naturalistic, and judicious use of intervening white lines could help clarify things, I think variants (1) and (3) are clearest, most readable, while (4) compares somewhat better on this than (2). More than three characters for the markups in (1), (2), and (3) would be helpful. (1), (2) and (3) all have the advantage that a change in heading length does not entail a change in the markup (separation of form and content). Moreover, copying is safer and easier. Authors can switch freely between styles (but not within one document), without there being interpretational ambiguity. The proposed markup also resembles traditional markups for *bold* and such -- in fact, this is logical, since headings in printed materials prefer big, bold type. A reasonable set of constraints would look like this: * the set of markup characters to choose from is [*+~#-= ...] * the markup that starts a heading must be identical to the one that ends that heading * the markup that starts and the one that ends a heading must consist of exactly / at least three identical characters from the above set * intervening whitespace between the markups and the text of the headline is discarded [and optional] * in one docstring, either indentation-free indication of levels or indication of structure by indentation is allowed * a mixed style is possible [, but must be coherently applied (same level ==> same markup)] * the style is determined by comparing the first heading in the text with the closest heading that differs from the first in either character markup or indentation * (in order to prevent ambiguities,) the mixed style is considered a variant of structure by indentation * headings may extend over more than one line Being intended as 'more than a compromise', I propose the described scheme as a way to allow authors freedom of choice between indented and indention-free styles of structural markup. Some details of this plan -- indentation, headings by enclosement within punctuation -- have enjoyed a certain degree of popularity in 'typewriter-like', constrained editing environments for the purpose of hassle-free, yet clear indication of headings. Other details -- such as using character markups for headlines at all, the omission of extra indentation, the free and yet consistent use of character markups for the indication of logical levels -- are ideas proposed recently in the group. -Wolf From lipp@epost.de Thu Jun 14 14:06:21 2001 From: lipp@epost.de (Wolfgang Lipp) Date: Thu, 14 Jun 2001 22:06:21 +0900 (Tokyo Standard Time) Subject: [Doc-SIG] Proposal for indented sections in reStructuredText Message-ID: <3B248CCF0002780D@mail.epost.de> (added by postmaster@mail.epost.de) >From: Guido van Rossum >Date: Thu, 14 Jun 2001 06:59:28 -0400 > >> Guido van Rossum wrote: >Very funny, but not a reasonable argument. Presenting program source >code has a history of about 50 years, and indentation has been part of >the presentation tradition for about 40 of those. Plain text however, >has been around for, oh, 30 centuries, and I am as skeptical of this >"innovation" as I am of many other "improvements" to text presentation >that have been proposed by computer geeks. you don't like *this*? >other way. For text, the length of sections (often more than a page) >mean that the human reader isn't very good at keeping track of >indentation levels. I bet you've been confused once or twice in your >life by a book where a significant indent coincided by a page break. >So we scan for the section headers to discern the section structure. >My conclusion: using indentation to discern section structure in text >would be as much giving in to the computer (which has no problem >keeping track of indents over many pages) as is using braces to >discern block structure in code. I'd conclude: indentation for text is not much different from using braces in text: easy for the machine, difficult for the human... ;-) apart from that, I've often been puzzled with indentations on-the-pagebreak -- but in my editor, there are no pages. As for indented text, I can, at least, *guess* the structural level locally by assessing the whitespace to the left; with mark-up-only, I have to scroll up in long texts seeking the last heading(s) (plural in case of free-form underline style) to find out (and that is something computers are much better in than I am). >> text. I agree. If a majority turns out to be in favour of a more liberal >> solution that allows more than one way, would that beat TSBOOWTDI, or is >> TSBOOWTDI even above that? > >Sure, but I would doubt a majority of votes in this forum, where geeks >are overrepresented. What kind of voting is the custom, then? (Got to find out, I guess). Thanks for the reply, I enjoyed reading it. -Wolf From guido@digicool.com Thu Jun 14 14:26:27 2001 From: guido@digicool.com (Guido van Rossum) Date: Thu, 14 Jun 2001 09:26:27 -0400 Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: Your message of "Thu, 14 Jun 2001 22:06:21 +0900." <3B248CCF0002780D@mail.epost.de> (added by postmaster@mail.epost.de) References: <3B248CCF0002780D@mail.epost.de> (added by postmaster@mail.epost.de) Message-ID: <200106141326.JAA25837@cj20424-a.reston1.va.home.com> > From: Wolfgang Lipp > >> Guido van Rossum wrote: > >Very funny, but not a reasonable argument. Presenting program source > >code has a history of about 50 years, and indentation has been part of > >the presentation tradition for about 40 of those. Plain text however, > >has been around for, oh, 30 centuries, and I am as skeptical of this > >"innovation" as I am of many other "improvements" to text presentation > >that have been proposed by computer geeks. > > you don't like *this*? Assuming you're talking about using *word* for emphasis, it strikes me as something we have to put up with for a little while longer until our standard communications tools are more capable -- just as in the 70s, some computer science papers were computer-formatted on a mainframe that could only print UPPER CASE LETTERS. As more and more people are capable or reading and writing HTML-enhanced email, I hope we'll get used to reading that's more pleasing to the eye than fixed-width ASCII. (And those who hate HTML email because it can be abused to the point of being unreadable, I remind that text email has its problems too, such as mailers auto-wrapping already preformatted text.) > I'd conclude: indentation for text is not much different > from using braces in text: easy for the machine, difficult > for the human... ;-) apart from that, I've often been puzzled with > indentations on-the-pagebreak -- but in my editor, there are > no pages. As for indented text, I can, at least, *guess* the > structural level locally by assessing the whitespace to the > left; with mark-up-only, I have to scroll up in long texts > seeking the last heading(s) (plural in case of free-form > underline style) to find out (and that is something computers > are much better in than I am). Assuming you care. The large structure of text is much less relevant than the structure of code. > >> text. I agree. If a majority turns out to be in favour of a more liberal > >> solution that allows more than one way, would that beat TSBOOWTDI, or is > >> TSBOOWTDI even above that? > > > >Sure, but I would doubt a majority of votes in this forum, where geeks > >are overrepresented. > > What kind of voting is the custom, then? (Got to find out, I guess). In the Python world, you have to convince me. *Sometimes* a large number of responses in favor or against (as just happened with PEP 259 :-) convinces me. *Sometimes* a single well-reasoned argument can convince me. And *sometimes* we both just have to do our own thing... :-) > Thanks for the reply, I enjoyed reading it. You're welcome. --Guido van Rossum (home page: http://www.python.org/~guido/) From klm@digicool.com Thu Jun 14 18:08:48 2001 From: klm@digicool.com (Ken Manheimer) Date: Thu, 14 Jun 2001 13:08:48 -0400 (EDT) Subject: [Doc-SIG] Re: Proposal for indented sections in reStructuredText In-Reply-To: Message-ID: I'm a little frustrated by the intensity of the rhetoric in the pro-indentation camp. While i'm one of those that **like** using indentation to indicate sectional structure, i've also heard enough people express valid reservations that i realize that it's a mixed bag. I think it's misguided to argue as if there's some natural law that makes it fundamentally "right". (I particularly cringe when i hear it called "pythonic" - or "unpythonic", for that matter. I suspect either term is purely unsubstantial in this context.) On Wed, 13 Jun 2001 David Goodger wrote: > The vehement feedback from Wolfgang Lipp and Edward Welbourne, as well as > the notes of regret from Ken Manheimer and Doug Hellmann, caused me to > reflect on the real reasons why I reject how StructuredText uses indentation > for sections. I then came up with a form of indented sections that I can > live with, and I hope everyone else can too. The rejection rationale and > proposed solution follow. Please let me know what you think. To clarify, my note of regret was about the *need* for leaving it behind, not doubts about the judgment that it may be necessary. While david's compromise proposal - allow both - appeals to me, i suspect we'd be better off going with just not using indentation for sectional structure. (As with many of the ideas in the proposal, though, i think there's good insight in putting the section header at the same indentation level as the paragraphs!) Here's what's crucial to me. While i think it's easier to _read_ the structure with section indentation, i also realize it's a genuine nuisance for many people to have to _write_ that way. It's a different thing to demand indentation for program text. Program text has elaborate structure *expressed* through indentation - most conventional programming languages (not just python!) require exquisite indentation so people can easily read them. The same is *not* true of prose text! The problem with the compromise comes in when someone edits someone else's document. If the first person has the tools and inclination to do section indentation, then the next person may be obliged to do so also, even if they lack the support and/or inclination. (I'm not sure whether the proposal allows them to be intermixed - but i also doubt that would be a good thing.) > (I would miss indentation as the cue for section depth nesting when > _reading_ stx source - i find it more clear even than in the formatted > presentation - but i guess for most people it's an unacceptable burden > to _write_ by that rule. So be it.) In general, the more i think about the specifics of david's main proposal, the more i like them. I'm not sure the compromise improves it. I'm willing to accept it either way. (BTW, i'd vote to we keep both the ** and **** styles of emphasis. I use them both, and find the implication so natural as to not substantially add "cognitive burden". Also, i really like the idea of having the alternative heading styles to some degree up to the author, depending just on their consistency rather than some memorized canon.) Ken klm@digicool.com From dgoodger@bigfoot.com Fri Jun 15 04:56:02 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Thu, 14 Jun 2001 23:56:02 -0400 Subject: [Doc-SIG] Re: PEP 257: Docstring Conventions In-Reply-To: <01061313582203.05742@frock.ddmweb.com> Message-ID: on 2001-06-13 4:45 PM, Sam Penrose (sam@ddmweb.com) wrote: >>>> This is a PEP-ification of part of Guido van Rossum's Python Style > Guide ... <<< > > parts of the Style Guide weather the conversion to a specification > better than others. For example... [omitted] > .... seems a bit visually oriented for the purpose of making > docstrings machine-parseable. Making docstrings machine-parsable is not the point of PEP 257, nor of the Style Guide from which it sprang. The point is to standardize the high-level structure of docstrings: what should they contain, and how to say it (without touching on any markup syntax within docstrings). Docstring spacing is one of the conventions that make Python code readable, IMHO. The Docstring Processing System is made up of layers of specs. PEP 257 is the highest-level, semantic part. The PEP contains conventions, not laws or syntax. If you violate the conventions, the worst you'll get is some dirty looks. But the DPS will know about some of the conventions, so following them will get you the best results. BTW, what's wrong with that specific convention? -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Fri Jun 15 05:22:52 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Fri, 15 Jun 2001 00:22:52 -0400 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: <011501c0f4b7$b1e1c650$f05aa8c0@lslp7o.int.lsl.co.uk> Message-ID: on 2001-06-14 5:52 AM, Tony J Ibbs (Tibs) (tony@lsl.co.uk) wrote: > I said I'd get round to commenting on David's documents (now formal > PEPs - yeh!), and I still haven't had the time to read them thoroughly, > let alone formulate proper comments. Yes, please do. Repetition may be useful though, so: > 2. Somewhere, I didn't notice it in my quick scan, it would be good to > emphasise that the *primary* aim of this project is doc strings, which > are *not* (meant to be) incredibly long. This means that constructs that > only work well in long documents are not as important (they are a *nice > thing*, but not the main reason for existence). Which document are you referring to? I believe the PEPs do emphasize docstrings; I'll make sure to emphasize the emphasis ;-). reStructuredText is neutral on that point: applicable to docs of any length (just use what you need). I'm trying hard to keep the issues separate so they don't get bogged down. reStructuredText deals with markup syntax *only*, not usage. > 3. I believe (as discussed earlier) that we could drop **strong** > emphasis - I think one form of emphasis is enough for almost all > purposes, especially if there are problems nesting the two forms (which > I know Edward Loper has worried about in the past). I don't think nesting of inline markup is useful enough to complicate matters. And I do think both *emph* & **strong** are useful. > 4. There is a good description of how literal quoting works (i.e., what > characters may be adjacent to the quotes). I think this argument should > be extended to apply (suitably amended) to other forms of quoting as > well - I assume in David's mind it does already, but in the document I > browsed it wasn't explicit. You're referring to the beginning of the "Inline Markup" section, which lists 7 "inline markup start-string and end-string recognition rules"? It's applicable to all forms of inline markup. The examples listed use '*' in fact. > 5. Did it mention whether line breaks were allowed in things? Should be > no for literals, yes for other quoted thingies... Inline literals: """ Line breaks are *not* preserved; other whitespace is not guaranteed to be preserved. """ If you want linebreaks & whitespace preserved, use literal blocks instead. I'll add that to the spec. > 7. I *hate* the titles with "underlining" above as well as below - yuck. So don't use them? ;-> The most obvious underlines are '=' and '-'. I came up with 'overlines' to expand their use, before being forced to use other underline characters. > 8. What are the rules for how *many* "underlines" must be present for a > title - the same number as the title, end at the same column as the end > of the title, at least one... """ An underline/overline is a line of non-alphanumeric characters that begins in column 1 and extends at least as far as the right edge of the title text. When there an overline is used, the length and character used must match the underline. """ > 9. DOM - my experience is that trying to use a DOM tree to do the work > in leads to madness (I'll elucidate if anyone cares, but basically it's > clearly too constraining). Please do elucidate. I haven't gotten to the point of actually *using* the DOM yet, so I'm open to alternatives. Using DOM's not written in stone, but the DOM software does exist and seems to fit the bill. > However, I still reckon that producing a DOM > tree as final *output* is very useful. PEP 258 specifies DOM for the output of the docstring parser and input of the formatter. Does that (the former) qualify as "final output"? > 10. Oh - terminology on ".." - don't refer to them as "comments", since > "executable/meaningful comments" is an abomination. Refer to them as > (for instance) directive delimiters, How about 'processing instructions'? (He said, half seriously.) > and note that an implementation may ignore undefined directives It does: """ - If an implementation of reStructuredText does not recognize a directive (i.e., the directive-handler is not installed), the entire directive block (including the directive itself) will be treated as a literal block, and a warning generated. Thus '::' is a natural choice. """ Thanks for your input. I'm looking forward to further input once you *have* read the specs. :-) -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Fri Jun 15 05:48:24 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Fri, 15 Jun 2001 00:48:24 -0400 Subject: [Doc-SIG] Re: reStructuredText Markup Specification In-Reply-To: <3B248CCF000274D4@mail.epost.de> (added by postmaster@mail.epost.de> Message-ID: on 2001-06-14 8:39 AM, Wolfgang Lipp (wolfgang.lipp@epost.de) wrote: > (Peter, thanks for pointing out the demerits > of the other variants ;-) I must have missed something... Did Peter point out more than "they suck"? :-) (But seriously, did he?) > *** Top level heading *** ... > *** Second level heading *** ... > *** Title of Section 3 *** Maybe your emailer condensed the whitespace, but I had to look long and hard to see the 1-space indent of the second level heading. > *** Top level heading *** ... > +++ Second level heading +++ ... > *** Title of Section 3 *** Are you serious about the '*** title ***' syntax? If so, the difference between '***' and '+++' is *very* hard to see. > Please compare all of the above with the readability > of underlined headings, with identical text and spacing: I've got to say I don't see '*** title ***' as being any more readable than underlining. Less, I'd say: it's non-obvious to me and conflicts with inline markup (*emphasis* etc.). > (1), (2) and (3) all have the advantage that a change in > heading length does not entail a change in the markup > (separation of form and content). Perhaps, but this seems a weak argument. reStructuredText specifically allows underlines to be *longer* than the title text; there's no reason not to have 75-character-long underlines to allow for future editing. > Moreover, copying is safer and easier. Why, 1 line versus 2? > The proposed markup also resembles traditional markups for > *bold* and such -- in fact, this is logical, since headings > in printed materials prefer big, bold type. Too similar, methinks. (And you can put *emphasis* or **strong** in reStructuredText titles if you want to.) > * the style is determined by comparing the first > heading in the text with the closest heading that > differs from the first in either character markup > or indentation Do you mean "the *level* is determined..."? I don't follow the rest of the sentence either. > * headings may extend over more than one line I was thinking of allowing that in reStructuredText also, like:: This is a Very Very Very Very Very Very Very Very Very Very Long Title ======================================= Comments anyone? > Being intended as 'more than a compromise', I propose the > described scheme as a way to allow authors freedom of > choice between indented and indention-free styles of > structural markup. I don't see how the proposed syntax aids in giving "freedom of choice." Care to elaborate? > Some details of this plan -- indentation, headings by > enclosement within punctuation -- have enjoyed a certain > degree of popularity in 'typewriter-like', constrained > editing environments for the purpose of hassle-free, yet > clear indication of headings. Could you provide any pointers to examples? -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Fri Jun 15 06:02:07 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Fri, 15 Jun 2001 01:02:07 -0400 Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: <200106131316.JAA11893@cj20424-a.reston1.va.home.com> Message-ID: In light of Guido's arguments (backed by his Dictatorship ;-) and Ken's clarification -- thank you both -- I'm prepared to back out the changes allowing indented sections. Before I do that, however, I'd like to hear from anyone with something to add, especially if a well-reasoned argument is forthcoming. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From pf@artcom-gmbh.de Fri Jun 15 07:10:17 2001 From: pf@artcom-gmbh.de (Peter Funk) Date: Fri, 15 Jun 2001 08:10:17 +0200 (MEST) Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: from David Goodger at "Jun 15, 2001 01:02:07 am" Message-ID: Hi, David Goodger: > In light of Guido's arguments (backed by his Dictatorship ;-) and Ken's > clarification -- thank you both -- I'm prepared to back out the changes > allowing indented sections. Before I do that, however, I'd like to hear from > anyone with something to add, especially if a well-reasoned argument is > forthcoming. Well, in doc strings we don't need a deep nested structure like for example H1, H2 ... H6 in HTML or chapter, section, subsection ... in LaTeX. If restructured text limits itself to at most two levels, using '=' as a underline character for top level headings und '-' as a underline character for nested section headings is okay. But IMO the different over- und underlining styles and the automatic recognition of styles described in your proposal is way too much freedom for writers. This seems unpythonic to me. At least for Python doc-strings the title style to be used should be restricted. Regards, Peter -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany) From castor@snafu.de Fri Jun 15 09:34:45 2001 From: castor@snafu.de (castor@snafu.de) Date: Fri, 15 Jun 2001 08:34:45 MET Subject: [Doc-SIG] Re: Proposal for indented sections in reStructuredText Message-ID: On Thu, 14 Jun 2001 13:08:48 -0400 (EDT) Ken Manheimer wrote > I'm a little frustrated by the intensity of the rhetoric in the > pro-indentation camp. Sorry for that. My apologies especially to David. > I think it's misguided to argue as if there's some natural law > that makes it fundamentally "right". (I particularly cringe when i > hear it called "pythonic" - or "unpythonic", for that matter. I > suspect either term is purely unsubstantial in this context.) > [...] > most conventional programming languages (not just python!) require > exquisite indentation so people can easily read them. If indentation would be "fundamentally right" or "wrong", there would be much less argument. And I recall not a few points that centered on practical aspects from, I hope, both sides. I threw in "pythonic" because Python is -- to my knowledge, please correct me -- one of very few languages to use *significant* indentation. I guess all major points have been raised in the discussion, so we might as well call it a day. Sorry for the volume of it anyway, -Wolf From castor@snafu.de Fri Jun 15 10:47:31 2001 From: castor@snafu.de (castor@snafu.de) Date: Fri, 15 Jun 2001 09:47:31 MET Subject: [Doc-SIG] Re: reStructuredText Markup Specification Message-ID: On Fri, 15 Jun 2001 00:48:24 -0400, David Goodger wrote: > Maybe your emailer condensed the whitespace, but I had to look long and hard > to see the 1-space indent of the second level heading. I see a tab in my copy, and that's what I sent... > Are you serious about the '*** title ***' syntax? If so, the difference > between '***' and '+++' is *very* hard to see. It's obviously not limited to that. Four characters would be possible, too: #### Very Important #### ==== Read this ==== ---- Also important ---- I concede I might have the idea from some spam mail. > > * the style is determined by comparing the first > > heading in the text with the closest heading that > > differs from the first in either character markup > > or indentation > Do you mean "the *level* is determined..."? I don't follow the rest of the > sentence either. "Style" here refers to the choice between structure- by-indentation or structure-by-character-markup. In other words, if the first heading uses '####', and the following heading has no indentation either, but uses, say '****', than all levels in the docstring are determined by character markup. > I was thinking of allowing that in reStructuredText also, like:: > > This is a Very Very Very Very Very Very > Very Very Very Very Long Title > ======================================= > > Comments anyone? Yeah, I know. No problems with that. They should be allowed. > > I propose the > > described scheme as a way to allow authors freedom of > > choice between indented and indention-free styles of > > structural markup. > I don't see how the proposed syntax aids in giving "freedom of choice." Care > to elaborate? Yes. This was not, as the rest of the text was not, aimed against anything or anyone. (I guess I've been writing too in-flamed recently, so people automatically expect I'm attacking someone with every sentence.) This only serves to re-state a suggestion made earlier by, I think, David, and it is not unique to either "surrounding" or "underlining" headings. In both cases, the freedom of choice is the freedom to use either style: structure-by-indents vs. structure-by- character-markups. > > Some details of this plan -- indentation, headings by > > enclosement within punctuation -- have enjoyed a certain > > degree of popularity in 'typewriter-like', constrained > > editing environments for the purpose of hassle-free, yet > > clear indication of headings. > > Could you provide any pointers to examples? I always delete my spam mail :-) When I tried out this variant, it looked very familiar to me. Maybe it's primary use is really for emphasis. Headings are emphasized portions of the text. But I guess the case is pretty much settled in favour of (1) underlined, (2) non-indented headlines, if this forum were to vote. -Wolf From tony@lsl.co.uk Fri Jun 15 10:14:01 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Fri, 15 Jun 2001 10:14:01 +0100 Subject: [Doc-SIG] RE: Very long title strings/underlining In-Reply-To: Message-ID: <012401c0f57b$842cb980$f05aa8c0@lslp7o.int.lsl.co.uk> David Goodger (I think it must have been) wrote: > I was thinking of allowing that in reStructuredText also, like:: > > This is a Very Very Very Very Very Very > Very Very Very Very Long Title > ======================================= > > Comments anyone? castor@snafu.de responded: > Yeah, I know. No problems with that. They should be > allowed. Hmm. On aesthetic grounds (erm - "it's hard to read") I don't like that particularly - but that's probably more to do with an aversion to very long titles (which *are* hard to read). It also worries me a bit on "catching errors" grounds (but I think Edward Loper should comment on that if *he* has worries, since he's better at that end of things than I am). So, in summary, I guess colour me concerned, but not actively against. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "Bounce with the bunny. Strut with the duck. Spin with the chickens now - CLUCK CLUCK CLUCK!" BARNYARD DANCE! by Sandra Boynton My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From tony@lsl.co.uk Fri Jun 15 10:23:23 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Fri, 15 Jun 2001 10:23:23 +0100 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: Message-ID: <012501c0f57c$d2f75bf0$f05aa8c0@lslp7o.int.lsl.co.uk> Drat - I knew I should *really* read more before commenting - getting David to point out what I'd missed is a selfishly lazy way of proceeding... Mind you, point 1 *was* the most important one to say. David Goodger made various replies to my comments: > > 2. ...emphasise that the *primary* aim of this project > > is doc strings... > > Which document are you referring to? I believe the PEPs do emphasize > docstrings; I'll make sure to emphasize the emphasis ;-). It may just be poor scanning of the text on my part. > reStructuredText is neutral on that point: applicable > to docs of any length (just use what you need). I'm > trying hard to keep the issues separate so > they don't get bogged down. reStructuredText deals with > markup syntax *only*, not usage. OK - good point. > > 3. I believe (as discussed earlier) that we could drop **strong** > > emphasis... > > I don't think nesting of inline markup is useful enough to complicate > matters. And I do think both *emph* & **strong** are useful. And given other people have said the same, I'll drop the point. > > 5. Did it mention whether line breaks were allowed in > > things? Should be no for literals, yes for other quoted > > thingies... > > Inline literals: > > """ > Line breaks are *not* preserved; other whitespace is not > guaranteed to be preserved. > """ > > If you want linebreaks & whitespace preserved, use literal > blocks instead. > I'll add that to the spec. I see. *But* I would argue that whitespace preserving in inline literals *is* important (personally, I don't care if a linebreak in an inline literal is mapped to a single space or illegal). It's not a showstopper (heh, I'm one of the people who argued for losing escape characters and using literal blocks instead, so I don't think I can grumble too much if the argument is used back at me), but I think it might be a major inconvenience (which, he awkwardly maintains, the other would not...). > > 7. I *hate* the titles with "underlining" above as well as > below - yuck. > > So don't use them? ;-> Grumble, mumble, humph. > The most obvious underlines are '=' and '-'. I came up with > 'overlines' to expand their use, before being forced to use > other underline characters. Understood. It's not a point to refuse a PEP on, so far as I'm concerned. > > 10. Oh - terminology on ".." - don't refer to them as > > "comments"... > > How about 'processing instructions'? (He said, half seriously.) I don't care much what the term is (that one is OK) so long as it doesn't imply that "ignored for meaning" terms are being used for meaning (which "comment" did). > > and note that an implementation may ignore undefined directives > > It does: Thanks. I *definitely* need to read these things. Maybe this weekend... Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "Bounce with the bunny. Strut with the duck. Spin with the chickens now - CLUCK CLUCK CLUCK!" BARNYARD DANCE! by Sandra Boynton My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From tony@lsl.co.uk Fri Jun 15 10:43:53 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Fri, 15 Jun 2001 10:43:53 +0100 Subject: [Doc-SIG] DOM as output, not as internal In-Reply-To: Message-ID: <012601c0f57f$b09aa370$f05aa8c0@lslp7o.int.lsl.co.uk> I said: > 9. DOM - my experience is that trying to use a DOM tree to > do the work in leads to madness (I'll elucidate if anyone > cares, but basically it's clearly too constraining). David Goodger said: > Please do elucidate. I haven't gotten to the point of > actually *using* the DOM yet, so I'm open to alternatives. > Using DOM's not written in stone, but the DOM software > does exist and seems to fit the bill. I said: > However, I still reckon that producing a DOM > tree as final *output* is very useful. David said: > PEP 258 specifies DOM for the output of the docstring parser > and input of the formatter. Does that (the former) qualify > as "final output"? Yes, that's exactly what I meant (I've not been concerning myself with the formatter particularly). Elucidating, I was thus thinking about the datastructures that one manipulates as one builds the document representation. Since the DOM is not designed for subclassing, if one wants *convenient* behaviours for one's classes, one has to either stick fingers into (for instance) minidom.py and *assume* that that is what will be used, or else reimplement one's one DOMlet. The former was the approach I took originally, and it was a pain because I had all this infrastructure that didn't *quite* match how I wanted to think about the document structure *whilst I was building it*, but the killer is that there is no guarantee that the minidom implementation won't change over Python releases (as indeed it has). The latter seems to be the approach that Zope has taken, but it's a pain for other reasons - who wants to maintain their own DOM when (a) other people are already doing it, and (b) there are more than one of them? (I think it is important that although we provide the ability to *produce* a DOM tree, we not mandate *whose* implementation we use) So what I did was to produce my own classes, so that I process the docstring and produce a datastructure representing it, and have an appropriate method to produce a DOM from that. This means that the person wanting to exploit the information from the docstring need only understand how DOM works (and, of course, what schema we are using!), and not my particular set of classes. Given the schema (DTD if you will), different implementations can be used to *produce* the DOM tree, which is exactly what we want. If the DOM producing method takes an existing DOM node as an argument, then we can even say we don't care *which* DOM implementation is being used (because one can get at the document from any node, and thus the factory methods) - assuming that the API for all Python DOM implementations is sufficiently similar (I *assume* that minidom and 4DOM, for instance, might be very similar for the sorts of operations we want to do - this may be naive, of course). In summary, mandating that the DOM be used for the intermediary between parser and formatter frees us up to choose different parsers and formatters at will, but I personally don't think that trying to use DOM inside the formatter gives useful advantages (and it is fairly trivial to *construct* a DOM from any sane internal datastructure!). Does that make sense? Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "Bounce with the bunny. Strut with the duck. Spin with the chickens now - CLUCK CLUCK CLUCK!" BARNYARD DANCE! by Sandra Boynton My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From rternosk@appliedtheory.com Fri Jun 15 20:12:21 2001 From: rternosk@appliedtheory.com (Robert Ternosky) Date: Fri, 15 Jun 2001 15:12:21 -0400 Subject: [Doc-SIG] Long verbatim blocks Message-ID: <200106151912.f5FJCLn05103@bearcat.appliedtheory.com> This is more of a general TeX question, but I can't find an answer, so here goes: I'm using the python-docs TeX setup/build process and I'm having a problem with long verbatim blocks. I have a code block that is longer than a page and upon generation of PDF or PS, the text runs off the page instead of page breaking (the HTML output looks fine). I tried \verbatiminput{filename}, which works great for PDF and PS, but for the html output, it just displays 'filename' instead of the contents of 'filename'. I was wondering how the doc-sig group solved this problem. Thanks -------- Bob Ternosky rternosk@appliedtheory.com http://bearcat.appliedtheory.com AppliedTheory Corporation From guido@digicool.com Fri Jun 15 20:18:50 2001 From: guido@digicool.com (Guido van Rossum) Date: Fri, 15 Jun 2001 15:18:50 -0400 Subject: [Doc-SIG] Long verbatim blocks In-Reply-To: Your message of "Fri, 15 Jun 2001 15:12:21 EDT." <200106151912.f5FJCLn05103@bearcat.appliedtheory.com> References: <200106151912.f5FJCLn05103@bearcat.appliedtheory.com> Message-ID: <200106151918.PAA32104@cj20424-a.reston1.va.home.com> > I'm using the python-docs TeX setup/build process and I'm having a > problem with long verbatim blocks. I have a code block that is > longer than a page and upon generation of PDF or PS, the text runs > off the page instead of page breaking (the HTML output looks fine). > > I tried \verbatiminput{filename}, which works great for PDF and PS, > but for the html output, it just displays 'filename' instead of the > contents of 'filename'. > > I was wondering how the doc-sig group solved this problem. This is just a wild guess, but it sounds like the TeX macros basically don't provide for breaking up long blocks -- it's as if you had an embedded image larger than the page, it just gives up. What I tend to do in such cases is break the verbatim block up at natural boundaries such as blank lines. There is no easy answer -- all publishers and toolsuites typically struggle with this one way or the other. (If the tools break the verbatim block up when it runs out of space, this is rarely where you would have *wanted* the break, so you end up intervening manually.) What would you do if you had to include a word that didn't fit on a line? --Guido van Rossum (home page: http://www.python.org/~guido/) From rternosk@bearcat.appliedtheory.com Fri Jun 15 20:28:34 2001 From: rternosk@bearcat.appliedtheory.com (Bob Ternosky) Date: Fri, 15 Jun 2001 15:28:34 -0400 Subject: [Doc-SIG] Long verbatim blocks In-Reply-To: Message from Guido van Rossum of "Fri, 15 Jun 2001 15:18:50 EDT." <200106151918.PAA32104@cj20424-a.reston1.va.home.com> Message-ID: <200106151928.f5FJSYf05249@bearcat.appliedtheory.com> >Guido van Rossum writes: >>Bob Ternosky writes: >> I'm using the python-docs TeX setup/build process and I'm having a >> problem with long verbatim blocks. I have a code block that is >> longer than a page and upon generation of PDF or PS, the text runs >> off the page instead of page breaking (the HTML output looks fine). > >This is just a wild guess, but it sounds like the TeX macros basically >don't provide for breaking up long blocks -- it's as if you had an >embedded image larger than the page, it just gives up. > >What I tend to do in such cases is break the verbatim block up at >natural boundaries such as blank lines. > >There is no easy answer -- all publishers and toolsuites typically >struggle with this one way or the other. Sigh...that's what I was afraid of. >What would you do if you had to include a word that didn't fit on a >line? Same thing. Break it up. Thanks again. -- Bob Ternosky rternosk@appliedtheory.com From fdrake@acm.org Fri Jun 15 21:02:09 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 15 Jun 2001 16:02:09 -0400 (EDT) Subject: [Doc-SIG] Long verbatim blocks In-Reply-To: <200106151912.f5FJCLn05103@bearcat.appliedtheory.com> References: <200106151912.f5FJCLn05103@bearcat.appliedtheory.com> Message-ID: <15146.27073.994093.708919@cj42289-a.reston1.va.home.com> Robert Ternosky writes: > I'm using the python-docs TeX setup/build process and I'm having a problem > with long verbatim blocks. I have a code block that is longer than a page > and upon generation of PDF or PS, the text runs off the page instead of page > breaking (the HTML output looks fine). The Python style sheets, in order to get verbatim content indented the way we like it, actually places the content in a minipage, which doesn't work properly with page breaks (a TeX or LaTeX issue I don't know how to finesse). If anyone knows how to create an indented verbatim environment that doesn't have the minipage problem, I'd love to hear about it. For long code blocks, i've just been breaking them up manually into separate verbatim blocks at points that seem to be appropriate and have the desired affect, but I don't consider this a good solution. > I tried \verbatiminput{filename}, which works great for PDF and PS, but for the > html output, it just displays 'filename' instead of the contents of > 'filename'. That's because the HTML conversion doesn't know about \verbatiminput -- I should be able to fix that. Can you point me to documentation for it, so I can be sure I get the details right? -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From rternosk@bearcat.appliedtheory.com Fri Jun 15 21:44:53 2001 From: rternosk@bearcat.appliedtheory.com (Bob Ternosky) Date: Fri, 15 Jun 2001 16:44:53 -0400 Subject: [Doc-SIG] Long verbatim blocks In-Reply-To: Message from "Fred L. Drake, Jr." of "Fri, 15 Jun 2001 16:02:09 EDT." <15146.27073.994093.708919@cj42289-a.reston1.va.home.com> Message-ID: <200106152044.f5FKisi05604@bearcat.appliedtheory.com> "Fred L. Drake, Jr." writes: > That's because the HTML conversion doesn't know about \verbatiminput >-- I should be able to fix that. Can you point me to documentation >for it, so I can be sure I get the details right? > Its part of the verbatim.sty package. On my Redhat system it was part of the tetex-latex-1.0.7-7 RPM and was installed as /usr/share/texmf/tex/latex/tools/verbatim.sty It can be downloaded from CTAN at: http://www.ctan.org/tex-archive/macros/latex209/contrib/amslatex/inputs/verbati m.sty I'm not sure where the actual distribution point is or if there is more documentation available. I found out about it from the LaTex FAQ: 14) In LaTeX, how do I include a file in the verbatim environment? A good way to do this is to use Rainer Schopf's verbatim.sty, which provides the command \verbatiminput that takes a file as an argument. This package is available from any CTAN site (see question 22) in ./tex-archive/macros/latex/distribs. Several files are needed. Another way to do this is to use the alltt environment defined in the style file alltt.sty available from the CTAN archives in ./tex-archive/macros/latex/contrib/misc/alltt.sty. Hope this helps. -- Bob Ternosky rternosk@appliedtheory.com From fdrake@acm.org Fri Jun 15 22:46:05 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 15 Jun 2001 17:46:05 -0400 (EDT) Subject: [Doc-SIG] Long verbatim blocks In-Reply-To: <200106152044.f5FKisi05604@bearcat.appliedtheory.com> References: <15146.27073.994093.708919@cj42289-a.reston1.va.home.com> <200106152044.f5FKisi05604@bearcat.appliedtheory.com> Message-ID: <15146.33309.224522.133399@cj42289-a.reston1.va.home.com> Bob Ternosky writes: > Its part of the verbatim.sty package. We're already pulling in whatever verbatim package is installed as part of the LaTeX package; I don't know if this is the same one, but it probably is (Rainer's name is included). > On my Redhat system it was part of the tetex-latex-1.0.7-7 RPM and > was installed as /usr/share/texmf/tex/latex/tools/verbatim.sty Much as on my Mandrake 7.2 box. Anyway, without reading the LaTeX source, I've written a version for LaTeX2HTML and checked it in as part of the Python documentation tools. You can pick up a new version of Doc/perl/python.perl from the Python CVS repository on SourceForge: http://sourceforge.net/projects/python/ If this doesn't do the trick for you, please let me know. You will need to place your verbatim files alongside your LaTeX sources. Thanks for the feedback on the tools! -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From dgoodger@bigfoot.com Sat Jun 16 03:04:32 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Fri, 15 Jun 2001 22:04:32 -0400 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: <012501c0f57c$d2f75bf0$f05aa8c0@lslp7o.int.lsl.co.uk> Message-ID: on 2001-06-15 5:23 AM, Tony J Ibbs (Tibs) (tony@lsl.co.uk) wrote: >>> 5. Did it mention whether line breaks were allowed in >>> things? Should be no for literals, yes for other quoted >>> thingies... >> >> Inline literals: >> >> """ >> Line breaks are *not* preserved; other whitespace is not >> guaranteed to be preserved. >> """ >> >> If you want linebreaks & whitespace preserved, use literal >> blocks instead. >> I'll add that to the spec. > > I see. *But* I would argue that whitespace preserving in inline literals > *is* important (personally, I don't care if a linebreak in an inline > literal is mapped to a single space or illegal). It's not a showstopper > (heh, I'm one of the people who argued for losing escape characters and > using literal blocks instead, so I don't think I can grumble too much if > the argument is used back at me), but I think it might be a major > inconvenience (which, he awkwardly maintains, the other would not...). Note that "is not guaranteed" is written, on purpose, specifically to cover cases of output formats that can't preserve whitespace. I just did a test, with this HTML: """

A test: One space here, two spaces here, Two spaces, newline, two spaces

""" MS IE 5.0 on MacOS 8.6 reduced all contiguous whitespace within TT tags to a single spaces. Ditto for Netscape Communicator 4.7. Is there another inline HTML tag which *preserves* runs of whitespace? I'll amend the spec along the lines of "although every attempt to preserve whitespace will be made, it is not guaranteed to be preserved," and specifically mention HTML's TT behavior. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From edloper@gradient.cis.upenn.edu Sat Jun 16 13:21:19 2001 From: edloper@gradient.cis.upenn.edu (Edward D. Loper) Date: Sat, 16 Jun 2001 08:21:19 EDT Subject: [Doc-SIG] A couple quick comments Message-ID: <200106161221.f5GCLJm21541@gradient.cis.upenn.edu> I haven't had as much time as I wanted to work on docstring stuff lately. But a couple quick comments: 1. I think we should try to concentrate on building a markup language for docstrings. I think that trying to create a general-purpose markup language, which is simple and easy and wonderful etc., is going to be too hard of a project. We'll make more progress if we just try to concentrate on docstrings. 2. Given that I would almost never use sections in a docstrings, I don't really care how we do sectioning, or if we have it at all. But I suggest we not exhaust too much of our energy on it.. 3. I think we should try to direct some energy at figuring out the details of the DPS. If we're to accept David's proposed approach, then markup decisions should be made pretty far down the road: first we create the DPS, then we construct a number of actual markups, so we can play with them and try them out, and *then* we'll have more experience with which to make decisions about which markup features we want. If all my playing with different docstring markups has taught me anything, it's that there can be very subtle consequences to decisions you make about the markup. I won't be happy accepting any argument about whether X or Y is "better" until I can really try them both out in the context of everything else we've decided. 4. I don't see a good reason to specify the interfaces used between DPS pieces using DOM. Using/manipulating DOM can be much more of a pain than using/manipulating Python objects. I think that we should define a set of classes for representing documentation (which would basically have a 1-to-1 correlation with a DTD). These classes should implement a toDOM() method (or some such), and maybe even have a fromDOM() type function.. I think it's much more convenient to say things like:: myclassdoc.methods()[3] than:: myclassdoc.findElements("method")[3].data or whatever it would be in DOM (sorry, it's been a little while). Anyway, that's all the time I have for now. I'm glad to see so much activity on the sig again. -Edward From guido@digicool.com Sat Jun 16 14:44:36 2001 From: guido@digicool.com (Guido van Rossum) Date: Sat, 16 Jun 2001 09:44:36 -0400 Subject: [Doc-SIG] A couple quick comments In-Reply-To: Your message of "Sat, 16 Jun 2001 08:21:19 EDT." <200106161221.f5GCLJm21541@gradient.cis.upenn.edu> References: <200106161221.f5GCLJm21541@gradient.cis.upenn.edu> Message-ID: <200106161344.JAA02272@cj20424-a.reston1.va.home.com> > 4. I don't see a good reason to specify the interfaces used between > DPS pieces using DOM. Using/manipulating DOM can be much more of > a pain than using/manipulating Python objects. Agreed! The DOM is a painful standard and unless there are external reasons to use it, I'd rather use Python the way I intended it. :-) --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@digicool.com Sat Jun 16 17:58:30 2001 From: guido@digicool.com (Guido van Rossum) Date: Sat, 16 Jun 2001 12:58:30 -0400 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: Your message of "Fri, 15 Jun 2001 22:04:32 EDT." References: Message-ID: <200106161658.MAA05872@cj20424-a.reston1.va.home.com> > MS IE 5.0 on MacOS 8.6 reduced all contiguous whitespace within TT tags to a > single spaces. Ditto for Netscape Communicator 4.7. Is there another inline > HTML tag which *preserves* runs of whitespace? I think this is how HTML is specified, for better or for worse. Most tools that require preservation of whitespace generate   if there are multiple spaces, although it's not always clear to me if it's better to generate "  " or "  ". --Guido van Rossum (home page: http://www.python.org/~guido/) From pf@artcom-gmbh.de Sat Jun 16 19:13:19 2001 From: pf@artcom-gmbh.de (Peter Funk) Date: Sat, 16 Jun 2001 20:13:19 +0200 (MEST) Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: <200106161658.MAA05872@cj20424-a.reston1.va.home.com> from Guido van Rossum at "Jun 16, 2001 12:58:30 pm" Message-ID: Hi, David: > > MS IE 5.0 on MacOS 8.6 reduced all contiguous whitespace within TT tags to a > > single spaces. Ditto for Netscape Communicator 4.7. Is there another inline > > HTML tag which *preserves* runs of whitespace? Guido van Rossum: > I think this is how HTML is specified, for better or for worse. Most > tools that require preservation of whitespace generate   if there > are multiple spaces, although it's not always clear to me if it's > better to generate "  " or "  ". May be I've missed the point, but was wrong with the
 tag?  For example:

def run(server_class=BaseHTTPServer.HTTPServer,
        handler_class=BaseHTTPServer.BaseHTTPRequestHandler):
    server_address = ('', 8000)
    httpd = server_class(server_address, handler_class)
    httpd.serve_forever()
(Cut'n'paste from the Python library reference as displayed by KDE KFM) If a Browser (MS IE 5.0) would display this, it is definitely broken. Regards, Peter -- Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260 office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany) From dgoodger@bigfoot.com Sat Jun 16 23:17:28 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sat, 16 Jun 2001 18:17:28 -0400 Subject: [Doc-SIG] Re:HTML TT tag not preserving whitespace In-Reply-To: Message-ID: on 2001-06-16 2:13 PM, Peter Funk (pf@artcom-gmbh.de) wrote: > May be I've missed the point, but was wrong with the
 tag?  For example:

We're talking about inline literal markup like , not literal blocks like
. This applies with text like::

    

There are three spaces in x after x = ' '.

Guido was saying that would need at least one   to come out right. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Sun Jun 17 03:50:49 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sat, 16 Jun 2001 22:50:49 -0400 Subject: [Doc-SIG] Proposal for indented sections in reStructuredText In-Reply-To: Message-ID: on 2001-06-15 2:10 AM, Peter Funk (pf@artcom-gmbh.de) wrote: > If restructured text limits itself to at most two levels, using '=' as > a underline character for top level headings und '-' as a underline > character for nested section headings is okay. > > But IMO the different over- und underlining styles and the automatic > recognition of styles described in your proposal is way too much freedom > for writers. This seems unpythonic to me. At least for Python doc-strings > the title style to be used should be restricted. I want to keep reStructuredText -- the syntax markup spec -- completely separate from the the conventions or limits imposed by Python docstrings. Saying that any aspect of reStructuredText is "pythonic" or "unpythonic" is a disservice. reStructuredText stands on its own, usage-neutral. I'd like to think that reStructuredText (or any markup syntax) could be applied in a variety of domains, just as I would defend the use of XML, POD, JavaDoc, or TeX as perfectly valid syntaxes in Python docstrings (don't ask me to use them though). Whether the biases or familiarities which attract individuals to Python also attract them to a certain docstring markup syntax... ;-) Having said that (let me switch perspectives here), if the docstring conventions were to specify a subset of reStructuredText, that would be fine. And yes, I know that I am guilty of conflict of interest regarding reStructuredText and the Docstring Processing System projects. I'm guilty of making decisions for reStructuredText based on "pythonic" criteria, of trying to appeal to the Python community and its final arbiter. Perhaps I should clean up my act and remove all inter-project contamination? Nah. Sometimes I take all of this too seriously. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Sun Jun 17 04:07:32 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sat, 16 Jun 2001 23:07:32 -0400 Subject: [Doc-SIG] A couple quick comments In-Reply-To: <200106161221.f5GCLJm21541@gradient.cis.upenn.edu> Message-ID: on 2001-06-16 8:21 AM, Edward D. Loper (edloper@gradient.cis.upenn.edu) wrote: > 1. I think we should try to concentrate on building a markup > language for docstrings. I think that trying to create a > general-purpose markup language, which is simple and easy and > wonderful etc., is going to be too hard of a project. We'll make > more progress if we just try to concentrate on docstrings. I personally am aiming for the general-purpose solution. I'd encourage you or anyone to pursue a docstring-specific variant or alternative. Whatever gets us there faster. Perhaps I'll change my tune once I've completed a few more hundred lines of code. > 3. I think we should try to direct some energy at figuring out the > details of the DPS. Yes please! There are lots of "XXX" bits in PEP 258. > If we're to accept David's proposed > approach, then markup decisions should be made pretty far down > the road: first we create the DPS, then we construct a number of > actual markups, so we can play with them and try them out, and > *then* we'll have more experience with which to make decisions > about which markup features we want. I prefer the Extreme Programming "continuous evolution" approach to design. I don't know what the DPS needs until I tackle each side of each API. I do welcome the advice of others with experience. In other words, not having a complete PEP 258 won't hinder me from writing an input parser. I personally won't be able to fill in some of the "XXX" bits until I've got at least a partial solution in place. Thanks. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From tony@lsl.co.uk Mon Jun 18 10:12:09 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Mon, 18 Jun 2001 10:12:09 +0100 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: Message-ID: <001701c0f7d6$c0f55720$f05aa8c0@lslp7o.int.lsl.co.uk> David Goodger wrote: > Note that "is not guaranteed" is written, on purpose, > specifically to cover cases of output formats that can't > preserve whitespace. ...elucidation of how HTML works... But what I wanted was the formatter to generate appropriate   tags for me. > I'll amend the spec along the lines of "although every > attempt to preserve whitespace will be made, it is not > guaranteed to be preserved," and specifically mention > HTML's TT behavior. Gosh, coming from (amongst other things) a TeX background, it always makes go *cringe* when HTML is used as a description of formatting (yes, I know, I know). Anyway, what I (that is, me - I can't guarantee anyone else) *specifically* want is two things: 1. Ability to have inline literals with the 'correct' number of spaces (which is achievable to the "normal" standard in HTML with  , with verbatim spaces in [La]TeX, and by other means in other presentation media. 2. Ability to have a non-breaking space (which *seems* to work with   in HTML - I haven't got a spec to hand, but "seems to work" does appear to be the "normal" standard for HTML), and is ~ in [La]TeX, etc. Of these, the second is the more important to me, and a folding of the two into   for HTML and ~ for [La]TeX seems to be the easiest to do (otherwise we need an escape mechanism for non-breaking spaces, which I'd decrie). So if inline literals preserve spaces and can't span lines, I would be happy (NB: it *should* be up to the presentation format what it does with these, so the parser certainly shouldn't be dropping the spaces, for inline literals at least). Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "Bounce with the bunny. Strut with the duck. Spin with the chickens now - CLUCK CLUCK CLUCK!" BARNYARD DANCE! by Sandra Boynton My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From tony@lsl.co.uk Mon Jun 18 10:12:13 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Mon, 18 Jun 2001 10:12:13 +0100 Subject: [Doc-SIG] A couple quick comments In-Reply-To: <200106161344.JAA02272@cj20424-a.reston1.va.home.com> Message-ID: <001801c0f7d6$c3030170$f05aa8c0@lslp7o.int.lsl.co.uk> Guido van Rossum wrote (in response to Edward Loper): > > 4. I don't see a good reason to specify the interfaces > > used between DPS pieces using DOM. Using/manipulating > > DOM can be much more of a pain than using/manipulating > > Python objects. > > Agreed! The DOM is a painful standard and unless there are external > reasons to use it, I'd rather use Python the way I intended it. :-) Certainly using Python directly would be nicer (heh, that's a given), although I don't think I find that bit of the XML world as painful as Guido. I'd not grumble if DOM "intermediary" was not required. My initial reason for wanting the DOM in place was because I thought we might have multiple back/fore-ends developed indendependently. This seems less important now we have a centralised set of PEPs to work around. Given the agreement above, I would go for dropping it as an intermediary form. Of course, there's still the problem of working out the API, in that case... The DTDs or some other formalism are still a useful thing to have around, I think, and it may well *be* useful to be able to produce DOM for other purposes. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "Bounce with the bunny. Strut with the duck. Spin with the chickens now - CLUCK CLUCK CLUCK!" BARNYARD DANCE! by Sandra Boynton My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From dgoodger@bigfoot.com Tue Jun 19 05:14:05 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Tue, 19 Jun 2001 00:14:05 -0400 Subject: [Doc-SIG] The Rise and Fall of Indented Sections Message-ID: Following two impassioned arguments [1]_ on the Doc-SIG against abolishing indentation for section structure, I reconsidered my arguments and posted a comporomise `Proposal for indented sections in reStructuredText`_. .. [1] One from `Wolfgang Lipp`_ and one from `Edward Welbourne`_. .. Wolfgang Lipp: http://mail.python.org/pipermail/doc-sig/2001-June/001872.html .. Edward Welbourne: http://mail.python.org/pipermail/doc-sig/2001-June/001877.html .. Proposal for indented sections in reStructuredText: http://mail.python.org/pipermail/doc-sig/2001-June/001890.html Response from most of the pro-indentation camp was positive. `Guido van Rossum`_ was against section-indentation, citing 30+ centuries of tradition, reinforcing my original arguments, and invoking "there's only one way to do it." As Dictator and chief arbiter of Python morals, Guido's opinions are always influential. But the most convincing arguments came from a surprising source: `Ken Manheimer`_, a once-stalwart proponent of indented sections, made a strong case *against* their continued use. He still likes them, finds them easier to read, but concedes that they can be hard to write. He'll miss them. You've got to admire that kind of objectivity. .. Guido van Rossum: http://mail.python.org/pipermail/doc-sig/2001-June/001893.html .. Ken Manheimer: http://mail.python.org/pipermail/doc-sig/2001-June/001901.html Convinced by Guido's and Ken's arguments, in the wee hours of Friday, June 15, I put out a call for final arguments in favor of indented sections. Some attempts were made, but we knew the cause was lost. It is my sad duty to report the tragic demise of indented sections in reStructuredText. Indented sections are dead! Long live reStructuredText! In Memoriam ----------- Born June 12, died June 18. It had a brief but exciting life. Requiescat In Pace. For the sake of posterity, the text removed from the spec regarding indented sections is included below. Removed from `Problems With StructuredText`_, version 0.2.1, end of section 3: However, indented sections are dear to many users of StructuredText. reStructuredText recognizes the value of indented sections by also allowing entire section bodies to be indented relative to the title. Title adornment (an underline and possibly an overline) is still required, as is overall consistency. Once a section is indented, all subsections must also be indented relative to their titles. Title adornment style usage must remain consistent. .. Problems With StructuredText: http://structuredtext.sf.net/spec/problems.txt Removed from `reStructuredText Markup Specification`_, version 0.2.1, 'Section Structure', end of first paragraph: A section may optionally be indented relative to its enclosing block. Once a section is indented, all of its subsections must be further indented. End of second paragraph: With indented sections, adornment styles may be reused. .. reStructuredText Markup Specification: http://structuredtext.sf.net/spec/reStructuredText.txt -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From rternosk@appliedtheory.com Tue Jun 19 15:44:38 2001 From: rternosk@appliedtheory.com (Robert Ternosky) Date: Tue, 19 Jun 2001 10:44:38 -0400 Subject: [Doc-SIG] PDF/PS problems with tableiii from python.sty Message-ID: <200106191444.f5JEicI10119@bearcat.appliedtheory.com> I'm converting some of LaTeX docs I've written to using the python-docs texinputs. Things have been going great until I started re-doing tables. I want to use the \tableiii and \lineiii macros to replace this: \begin{table}[h] \begin{tabular}{|l|l|l|} \hline $\strong{Party}$&$\strong{Obligations}$&$\strong{Benefits}$\\ \hline Client & Satisfy Precondition: & From Postcondition: \\ & Call 'put' on a & stack is updated: is not \\ & non-full stack only & empty, x on top (item yields \\ & & x), count increased by 1 \\ \hline Supplier & Satisfy Postcondition: & From Precondition: \\ & Update stack to have x & Simpler processing thanks \\ & on top (item yields x) & to the assumption that \\ & count increased by 1, & stack is not full \\ & not empty. & \\ \hline \end{tabular} \caption{Obligation and Benefits of put routine} \end{table} with this: \begin{tableiii}{|l|l|l|}{code}{Party}{Obligations}{Benefits} \lineiii{Client} {Satisfy Precondition: \\ Only call put on a non-full stack.} {From Postcondition: \\ stack is updated: it's not empty, \\ x is on top (item yields x), \\ count increased by 1} \lineiii{Supplier} {Satisfy Postcondition: \\ Update stack to have x on top \\ (item yields x), count increased by 1, \\ stack not empty.} {From Precondition: \\ Simpler processing thanks to the \\ assumption that stack is not full.} \label{tab:putMethod} \end{tableiii} I also tried removing the '\\' markers so that the 2nd and 3rd args to \lineiii we're one long string. In both cases the table is unreadable in the Postscript and PDF versions, but the HTML comes out perfect. Am I mis-using this? The problem seems to arise due to the multi-line nature of the 2nd and 3rd arguments to \lineiii. Can I not use the macros in this case? Any suggestions? -------- Bob Ternosky rternosk@appliedtheory.com AppliedTheory Corporation From sam@ddmweb.com Tue Jun 19 17:30:01 2001 From: sam@ddmweb.com (Sam Penrose) Date: Tue, 19 Jun 2001 09:30:01 -0700 Subject: [Doc-SIG] Re: PEP 257: Docstring Conventions In-Reply-To: References: Message-ID: <01061910135400.04347@frock.ddmweb.com> Sorry for the delay in getting back to you; I was on vacation. My mistake on the purpose of 257. What is readable depends in on context. I think Guido's Style Guide is basically great but too specific in some ways and not specific enough in others to use as a spec. The Guide mashes together commentary which, when made a spec, is appropriate for differing contexts: 1) The minimum necessary for cross-platform and cross-editor development. 2) Additional layers and conventions important for those contributing to Python release code so that they can work together. 3) What Guido thinks looks good; the "for symetry" comment I singled is one example; "The closing quotes are on the same line as the opening quotes. This looks better for one-liners" is another. While I happen to agree with this and follow it, I don't think it belongs in a specification (as opposed to a Style Guide). I am a little uncomfortable with your comment that "the DPS will know about some of the conventions, so following them will get you the best results." "Getting the best results" has the sound of "a little bit pregnant" to me, as do some of your other phrases. What is style and what is spec? 4) To be crystal clear: I would like to see a clear line between which standards can be violated at the cost of dirty looks and which will cause DSP code to fail, and I'd like to see some of the current PEP contents explicitly moved to the first category. this-opinion-is-worth-what-you-paid-for-it-ly, S On Thu, 14 Jun 2001, you wrote: > on 2001-06-13 4:45 PM, Sam Penrose (sam@ddmweb.com) wrote: > >>>> This is a PEP-ification of part of Guido van Rossum's Python Style > > Guide ... <<< > > > > parts of the Style Guide weather the conversion to a specification > > better than others. For example... > [omitted] > > .... seems a bit visually oriented for the purpose of making > > docstrings machine-parseable. > > Making docstrings machine-parsable is not the point of PEP 257, nor of the > Style Guide from which it sprang. The point is to standardize the high-level > structure of docstrings: what should they contain, and how to say it > (without touching on any markup syntax within docstrings). Docstring spacing > is one of the conventions that make Python code readable, IMHO. The > Docstring Processing System is made up of layers of specs. PEP 257 is the > highest-level, semantic part. > > The PEP contains conventions, not laws or syntax. If you violate the > conventions, the worst you'll get is some dirty looks. But the DPS will know > about some of the conventions, so following them will get you the best > results. > > BTW, what's wrong with that specific convention? > > -- > David Goodger dgoodger@bigfoot.com Open-source projects: > - Python Docstring Processing System: http://docstring.sf.net > - reStructuredText: http://structuredtext.sf.net > - The Go Tools Project: http://gotools.sf.net From castor@snafu.de Wed Jun 20 12:53:01 2001 From: castor@snafu.de (castor@snafu.de) Date: Wed, 20 Jun 2001 11:53:01 MET Subject: [Doc-SIG] Implicit Link Targets Message-ID: Reading the `specification docs`_ once more, I realized it might be pretty desirable to have implicit link targets. More specifically, I suggest that titles of sections like Section Titles ============== as well as figure captions A figure (a graphic with a caption) could be placed like this:: .. figure:: larch.png The larch. could be made available as implicit link targets (I'm not quite sure whether figure captions are actually recognized as a distinct element in the spec; I'd have to check that). Since "Whitespace is normalized within hyperlink names, which are case-insensitive", authors can then refer to `section titles`_ and `the larch`_. It might be desirable to issue warnings in case non-unique titles/captions are actually referred to within the text. Implicit targets could be supplemented/overridden by explicit targets; their use would obliterate the need for most explicit targets seen in a text like the specification itself. Is that desirable/implementable? -wolf . _specification docs: http://structuredtext.sourceforge.net/ From tony@lsl.co.uk Wed Jun 20 11:09:53 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Wed, 20 Jun 2001 11:09:53 +0100 Subject: [Doc-SIG] Implicit Link Targets In-Reply-To: Message-ID: <000201c0f971$260a16f0$f05aa8c0@lslp7o.int.lsl.co.uk> castor@snafu.de (what a nice name) wrote: > Reading the `specification docs`_ once more, I realized it > might be pretty desirable to have implicit link targets. More > specifically, I suggest that titles of sections like > > Section Titles > ============== > > as well as figure captions ...deletia... > Is that desirable/implementable? The obvious problem is that of any such scheme, which is the difficulty of preserving unambiguity. There are contexts where one is required (by some external fiat or other) to write documents with a structure like: Section 1 --------- Introduction ~~~~~~~~~~~~ blah blah Details ~~~~~~~ blah blah Section 2 --------- Introduction ~~~~~~~~~~~~ blah blah and so on (I'm sure you get the idea). It becomes impossible to indicate a particular "Introduction" unambiguously without a more complex scheme (for instance, having to specify `Section 1//Introduction`_ - this way lies XPath) and given that the document owner (presumably) knows when they want labels, it's easier for them to just put them in where they're actually needed. There's also, then, the "side benefit" that one can see *what* is being referenced from elsewhere (heh, a "ComeFrom" statement!) - although this is not something I've ever particularly made conscious use of. The advantage of David's original idea is that it is both simple and globally used. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ In Python it's clearer to talk about "names" and "bindings" rather than "variables" and "values". (Greg Ewing) My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From dgoodger@bigfoot.com Thu Jun 21 04:27:54 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Wed, 20 Jun 2001 23:27:54 -0400 Subject: [Doc-SIG] Re: PEP 257: Docstring Conventions In-Reply-To: <01061910135400.04347@frock.ddmweb.com> Message-ID: on 2001-06-19 12:30 PM, Sam Penrose (sam@ddmweb.com) wrote: > What is readable depends in on context. I think Guido's > Style Guide is basically great but too specific in some ways and not > specific enough in others to use as a spec. The Guide mashes together > commentary which, when made a spec, is appropriate for differing > contexts: ... > What is style and what is spec? > > 4) To be crystal clear: I would like to see a clear line between which > standards can be violated at the cost of dirty looks and which will > cause DSP code to fail, and I'd like to see some of the current PEP > contents explicitly moved to the first category. These are valid points. I will work on making changes to the PEP. Any help you (or anyone) could give, such as specific "this is style and that is spec", or complete rewrites ;-) would be very welcome and helpful. > this-opinion-is-worth-what-you-paid-for-it-ly, Far, FAR more, to be sure. Thank you. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Thu Jun 21 05:01:46 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Thu, 21 Jun 2001 00:01:46 -0400 Subject: [Doc-SIG] Implicit Link Targets In-Reply-To: Message-ID: on 2001-06-20 7:53 AM, castor@snafu.de (castor@snafu.de) wrote: > Reading the `specification docs`_ once more, I realized it > might be pretty desirable to have implicit link targets. Having implicit link targets for titles is a good idea. Note that the 'figure' directive was just an example, and isn't an 'official' part of the spec. > It might be desirable to issue > warnings in case non-unique titles/captions are actually > referred to within the text. > > Implicit targets could be supplemented/overridden by explicit > targets; their use would obliterate the need for most explicit > targets seen in a text like the specification itself. > > Is that desirable/implementable? Yes, just as you specify. I spent a few minutes coming up with some simple rules: 1. Keep track of implicit & explicit links in separate dictionaries. 2. In case of: - duplicate explicit & implicit targets: priority to explicit - duplicate implicit targets: disable all of them, don't warn - duplicate explicit targets: warn & diable all of them 'Disable' means to remove link names from targets. System warning elements can be inserted where target links are disabled. The DPS won't care whether links are implicit or explicit. The parser must deliver a set of *unique* target links (as attributes on elements). The DPS can warn of unresolvable links, even giving reasons for the warnings. It will certainly make cross-reference-rich documents (like the spec :-) easier to read, and won't detract from understandability. "See 'Details' below" is a very common prose idiom, the literary hyperlink exactly. Just so long as there's a zero-tolerance policy on implicit hyperlink ambiguity in place, I don't see why it can't fly. Does this allay your misgivings, Tony? Thanks, Wolf. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From dgoodger@bigfoot.com Thu Jun 21 05:14:55 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Thu, 21 Jun 2001 00:14:55 -0400 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: <001701c0f7d6$c0f55720$f05aa8c0@lslp7o.int.lsl.co.uk> Message-ID: on 2001-06-18 5:12 AM, Tony J Ibbs (Tibs) (tony@lsl.co.uk) wrote: > Anyway, what I (that is, me - I can't guarantee anyone else) > *specifically* want is two things: > > 1. Ability to have inline literals with the 'correct' number of spaces ... > 2. Ability to have a non-breaking space In what contexts do you need a non-breaking space? One area reStructuredText doesn't touch is character sets or (SG|HT|X)ML-character-entity-equivalents.   can be considered part of markup or of character sets/entities. Suggestions? One point: I believe some time ago you thought that you could get away with using inline literals for non-breaking spaces:: no`` ``break (At the time the markup was single-backquotes, not double as above.) That's not supported by the spec, since the start-strings and end-strings aren't in the proper context; reversed contexts, in fact. > So if inline literals preserve spaces and can't span lines, > I would be happy Inline anything is part of the flow of the paragraph, and thus should be able to flow right along with the rest of the paragraph text. I can see satisfying 'preserve spaces', but inline literals *may* span lines. > (NB: it *should* be up to the presentation format what > it does with these, so the parser certainly shouldn't be dropping the > spaces, for inline literals at least). Agreed. -- David Goodger dgoodger@bigfoot.com Open-source projects: - Python Docstring Processing System: http://docstring.sf.net - reStructuredText: http://structuredtext.sf.net - The Go Tools Project: http://gotools.sf.net From tony@lsl.co.uk Thu Jun 21 10:39:52 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 21 Jun 2001 10:39:52 +0100 Subject: [Doc-SIG] Documentation markup & processing / PEPs In-Reply-To: Message-ID: <000901c0fa36$1f76c7f0$f05aa8c0@lslp7o.int.lsl.co.uk> David Goodger wrote: > In what contexts do you need a non-breaking space? Hmm. As always, I don't have a proper example to hand. Strings are always an obvious example (although such are, of course, most likely to occur in block literals, where spaces *are* preserved). If one has tables, then something like: +-----------+---------+ | String | Meaning | +===========+=========+ | `" x "` | One | | `" x "` | Two | +-----------+---------+ (yes, I know that's doubtless "drawn" wrongly) might be an example - the number of spaces is plainly being used significantly, and this *is* the sort of thing one might want to do in a doc string. > One area reStructuredText doesn't touch is character sets or > (SG|HT|X)ML-character-entity-equivalents. >   can be considered part of markup or of character sets/entities. > Suggestions? Hmm - I would be against introducing XML character entities (for two reasons - firstly because we don't want to be tied to XML, and secondly because if people see *one* XML-ism, then they may assume others "work"). Oh, and thirdly because they break the "the bare text should be readable" principle of StructuredText, which is STILL the most important reason for going this route. > One point: I believe some time ago you thought that you could > get away with using inline literals for non-breaking spaces:: > > no`` ``break Yes - I rather liked that, but as I recall Guido said it was a nasty trick he didn't like. Ho hum (and, as you say, it doesn't work in your current scheme, nor would it have worked in the earlier scheme). To clarify - I can probably put up with not having non-breaking spaces in "ordinary" text (although I say that reluctantly, because I feel they're useful - but then we're not trying for an all powerful typesetting system), but I feel that we really *do* need them in literal text. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "How fleeting are all human passions compared with the massive continuity of ducks." - Dorothy L. Sayers, "Gaudy Night" My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From tony@lsl.co.uk Thu Jun 21 10:41:00 2001 From: tony@lsl.co.uk (Tony J Ibbs (Tibs)) Date: Thu, 21 Jun 2001 10:41:00 +0100 Subject: [Doc-SIG] Implicit Link Targets In-Reply-To: Message-ID: <000a01c0fa36$47810670$f05aa8c0@lslp7o.int.lsl.co.uk> David Goodger wrote: ...an explanation of how he proposed to make implicit links work... > Does this allay your misgivings, Tony? I think so. It's not something I'm *too* worried about (!) - since my main concern is doc-strings, which don't normally have much sectional structure, it's something I'm willing to let flow and develop itself, to some extent. As you say, cross-reference rich documents will be simpler to read (as text) with this scheme, which is a Good Thing given the StructuredText principle of "the bare text must be readable". (btw - the sort of overly formal document structure I was mentioning last time is a pain for all sorts of reason, anyway, so I hope one doesn't have to write too many of them). I *am* glad you're not trying to support "scoping" (i.e., if I reference "introduction" in *this* section, and there's an "introduction" in another section, the one in this section gets chosen) since I think this would make the scheme over-complex. Tibs -- Tony J Ibbs (Tibs) http://www.tibsnjoan.co.uk/ "How fleeting are all human passions compared with the massive continuity of ducks." - Dorothy L. Sayers, "Gaudy Night" My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.) From fdrake@beowolf.digicool.com Fri Jun 22 19:31:44 2001 From: fdrake@beowolf.digicool.com (Fred Drake) Date: Fri, 22 Jun 2001 14:31:44 -0400 (EDT) Subject: [Doc-SIG] [maintenance doc updates] Message-ID: <20010622183144.C6A5428927@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/maint-docs/ Lots of smallish updates and corrections, moved the license statements to an appendix. From fdrake@beowolf.digicool.com Fri Jun 22 19:53:37 2001 From: fdrake@beowolf.digicool.com (Fred Drake) Date: Fri, 22 Jun 2001 14:53:37 -0400 (EDT) Subject: [Doc-SIG] [development doc updates] Message-ID: <20010622185337.BE51228927@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Lots of smallish updates and corrections, moved the license statements to an appendix. This version includes some contributed changes to the documentation for the cmath module. To make the LaTeX to HTML conversion work, I have made the resulting HTML contain entity references for the "plus/minus" and "infinity" symbols (± and ∞, respectively). These may be problematic for some browsers. Please let me know how it looks on your browser by sending an email to python-docs@python.org. Be sure to state your browser name and version, and what operating system you are using. Thanks! http://python.sourceforge.net/devel-docs/lib/module-cmath.html From fdrake@acm.org Fri Jun 22 21:29:28 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 22 Jun 2001 16:29:28 -0400 (EDT) Subject: [Doc-SIG] Browsers & the Python documentation Message-ID: <15155.43688.608790.42183@cj42289-a.reston1.va.home.com> Ok, between a few responses I've received from my query about browser support for ± and ∞, and the browsers I happen to have installed, here's what I've found: Browser | Version | O/S | ± | ∞ -----------|-------------|-------|----------|-------- Mozilla | 0.9, 0.9.1 | Linux | ok | ok Navigator | 4.76, 4.77 | Linux | ok | no! Opera | 5.0 | Linux | ok | no! Amaya | 4.3.2 | Linux | ok | ok Konqueror | 1.9.8 | Linux | ok | no! StarOffice | 5.2 | Linux | ok | no! gnome-help | 0.4 | Linux | ok | no! (but it sucks anyway) Lynx | 2.8.4dev.8 | Linux | ok | no! Links | 0.92 | Linux | kinda | no! -----------|-------------|-------|----------|-------- MSIE | 5.5 |Win98SE| ok | ok -----------|-------------|-------|----------|-------- MSIE | 6.0 preview | Win2K | ok | ok Mozilla | 0.9 | Win2K | ok | ok Navigator | 6.0 | Win2K | ok | ok Opera | 5.11 | Win2K | ok | no! I'd love to hear about browsers on Mac OS as well! -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From fdrake@beowolf.digicool.com Fri Jun 22 21:52:48 2001 From: fdrake@beowolf.digicool.com (Fred Drake) Date: Fri, 22 Jun 2001 16:52:48 -0400 (EDT) Subject: [Doc-SIG] [development doc updates] Message-ID: <20010622205248.6290128927@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ Changed the revised cmath documentation to use "j" as a suffix for complex literals instead of using "i" as a prefix; this is more similar to Python. Changed the font of the suffix to match that used elsewhere in the documentation. This should be a little more readable, but does not change any potential browser compatibility issues, so I still need reports of compatibility or non-compatibility. See my prelimiary report on the topic at: http://mail.python.org/pipermail/doc-sig/2001-June/001940.html From mwh@python.net Sat Jun 23 10:16:58 2001 From: mwh@python.net (Michael Hudson) Date: 23 Jun 2001 10:16:58 +0100 Subject: [Doc-SIG] Browsers & the Python documentation In-Reply-To: "Fred L. Drake, Jr."'s message of "Fri, 22 Jun 2001 16:29:28 -0400 (EDT)" References: <15155.43688.608790.42183@cj42289-a.reston1.va.home.com> Message-ID: "Fred L. Drake, Jr." writes: > Ok, between a few responses I've received from my query about > browser support for ± and ∞, and the browsers I happen to > have installed, here's what I've found: > > > Browser | Version | O/S | ± | ∞ > -----------|-------------|-------|----------|-------- > Mozilla | 0.9, 0.9.1 | Linux | ok | ok > Navigator | 4.76, 4.77 | Linux | ok | no! > Opera | 5.0 | Linux | ok | no! > Amaya | 4.3.2 | Linux | ok | ok > Konqueror | 1.9.8 | Linux | ok | no! > StarOffice | 5.2 | Linux | ok | no! > gnome-help | 0.4 | Linux | ok | no! (but it sucks anyway) > Lynx | 2.8.4dev.8 | Linux | ok | no! > Links | 0.92 | Linux | kinda | no! w3m | 0.1.6 | Linux | ok | no Is there an infinity symbol in iso-8859-1? That would make it tricky for text-mode browsers at the moment... Cheers, M. -- . <- the point your article -> . |------------------------- a long way ------------------------| -- Cristophe Rhodes, ucam.chat From tim.one@home.com Sat Jun 23 10:25:55 2001 From: tim.one@home.com (Tim Peters) Date: Sat, 23 Jun 2001 05:25:55 -0400 Subject: [Doc-SIG] Browsers & the Python documentation In-Reply-To: Message-ID: [Michael Hudson] > Is there an infinity symbol in iso-8859-1? That would make it tricky > for text-mode browsers at the moment... oo - oo == NaN. Especially at 5 in the morning, two little "o"s juxtaposed look more like infinity than God Himself . From dgoodger@bigfoot.com Sat Jun 23 14:49:49 2001 From: dgoodger@bigfoot.com (David Goodger) Date: Sat, 23 Jun 2001 09:49:49 -0400 Subject: [Doc-SIG] Browsers & the Python documentation In-Reply-To: <15155.43688.608790.42183@cj42289-a.reston1.va.home.com> Message-ID: Browser | Version | O/S | ± | ∞ -----------|-------------|-------|----------|-------- MSIE | 5.0 | MacOS*| ok | ok Navigator | 4.72 | MacOS*| ok | no * MacOS 8.6 From fdrake@beowolf.digicool.com Sun Jun 24 03:41:04 2001 From: fdrake@beowolf.digicool.com (Fred Drake) Date: Sat, 23 Jun 2001 22:41:04 -0400 (EDT) Subject: [Doc-SIG] [development doc updates] Message-ID: <20010624024104.A757728927@beowolf.digicool.com> The development version of the documentation has been updated: http://python.sourceforge.net/devel-docs/ A couple of small updates, including spelling the keywords correctly in the language reference. This version brings back the hyperlinked grammar productions I played around with earlier. They still need work, but they are somewhat better than plain text. From summer@ourobourus.com Wed Jun 27 09:11:51 2001 From: summer@ourobourus.com (Mark Summerfield) Date: Wed, 27 Jun 2001 10:11:51 +0200 Subject: [Doc-SIG] Announce: RTX 1.0.0 yet another plain-text-ish markup Message-ID: <01062710115144.28534@sylkie> Hi, If you're interested in plain text-ish markup you might find RTX of interest: http://www.ourobourus.com It is vaguely reminiscent of doxygen since it takes lots of ideas from qdoc (of which doxygen is a public implementation). Basically you can write with a minimally intrusive markup and produce HTML, SGML (docbook), Lout (which generates postscript and PDF) and plain text. It handles lists and tables as well as 'categorising' markup, e.g. \key Alt+F. It does not support much 'formatting' markup, e.g. fonts etc. in the text itself, but you have considerable control over how the output works in the supported formats (so you can control fonts, colours etc. globally for consistency by changing simple configuration files). It is quite easy to subclass to produce your own format (it's all written in pure Python). I don't use it to markup Python code, at least not yet, but doing so should be straightforward. Below are some notes on this possibility (but extracting marked up text from Python code isn't supported yet -- but hopefully will be soon). Here's how a fragment of David Goodger's documentation looks using his reStructuredText: def __init__(self, stateclasses, initialstate, debug=0): """ Initialize a `StateMachine` object; add state objects. Parameters: - `stateclasses`: a list of `State` (sub)classes. - `initialstate: a string, the name of the initial state (class name). - `debug`: a boolean; produce verbose output if true (nonzero). """ here's how you'd achieve the same thing using RTX (only I wouldn't do this; see the final example): def __init__(self, stateclasses, initialstate, debug=0): """ Initialize a \class StateMachine object; add state objects. Parameters: \list \e \p stateclasses a list of \class State (sub)classes. \e \p initialstate a string, the name of the initial state (class name). \e \p debug a boolean; produce verbose output if true (nonzero). \endlist """ The \e is a cell or list element, the \p is a parameter. (If you need to group a phrase you'd do \b[bold phrase] -- yes bold and italic are supported even though they aren't categorisation.) The way I'd have written the thing is like this: def __init__(self, stateclasses, initialstate, debug=0): ''' Initialize a \class StateMachine object; add state objects. The \p stateclasses is a list of \class State (sub)classes. The initial state (which is a class name) is in the \p initialstate string. If you want verbose output set \p debug to true (its default is false). ''' If you wanted to do this you'd have to extract the text yourself and then run it through RTX. I will make RTX capable of doing this itself soon. BTW I am not keen on defining the presentational structure within the description itself. For me the presentation is a concern of the output formatter and what I want to feed into that is categorisation, i.e. this is a class name, this is a method name, etc. -- Mark. From fdrake@acm.org Fri Jun 29 20:24:00 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Fri, 29 Jun 2001 15:24:00 -0400 (EDT) Subject: [Doc-SIG] Python 2.1 docs in GNU info format Message-ID: <15164.54736.838888.800048@cj42289-a.reston1.va.home.com> Milan Zamazal has contributed Python 2.1 documentation in GNU info format. It is available on python.org: ftp://ftp.python.org/pub/python/doc/2.1/ and on SourceForge: http://sourceforge.net/project/showfiles.php?group_id=5470&release_id=41415 Thanks, Milan! -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations