Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style the python help files (they are pretty ugly...) #6

Open
jlegewie opened this issue Apr 13, 2012 · 1 comment
Open

style the python help files (they are pretty ugly...) #6

jlegewie opened this issue Apr 13, 2012 · 1 comment

Comments

@jlegewie
Copy link
Owner

the bad thing is that they don't use css:
http://bugs.python.org/issue10716

@jlegewie
Copy link
Owner Author

use pandoc to convert reStructuredText output from pydoc to html for easy GitHub like styling. There is also a python wrapper for pandoc.
This approach requires that pandoc is installed so that it should be optional.

Here is an example:
http://johnmacfarlane.net/pandoc/try

Class definitions
*****************

A class definition defines a class object (see section *The standard
type hierarchy*):

   classdef    ::= "class" classname [inheritance] ":" suite
   inheritance ::= "(" [expression_list] ")"
   classname   ::= identifier

A class definition is an executable statement.  It first evaluates the
inheritance list, if present.  Each item in the inheritance list
should evaluate to a class object or class type which allows
subclassing.  The class's suite is then executed in a new execution
frame (see section *Naming and binding*), using a newly created local
namespace and the original global namespace. (Usually, the suite
contains only function definitions.)  When the class's suite finishes
execution, its execution frame is discarded but its local namespace is
saved. [4] A class object is then created using the inheritance list
for the base classes and the saved local namespace for the attribute
dictionary.  The class name is bound to this class object in the
original local namespace.

**Programmer's note:** Variables defined in the class definition are
class variables; they are shared by all instances.  To create instance
variables, they can be set in a method with ``self.name = value``.
Both class and instance variables are accessible through the notation
"``self.name``", and an instance variable hides a class variable with
the same name when accessed in this way. Class variables can be used
as defaults for instance variables, but using mutable values there can
lead to unexpected results.  For *new-style class*es, descriptors can
be used to create instance variables with different implementation
details.

Class definitions, like function definitions, may be wrapped by one or
more *decorator* expressions.  The evaluation rules for the decorator
expressions are the same as for functions.  The result must be a class
object, which is then bound to the class name.

-[ Footnotes ]-

[1] The exception is propagated to the invocation stack only if there
    is no ``finally`` clause that negates the exception.

[2] Currently, control "flows off the end" except in the case of an
    exception or the execution of a ``return``, ``continue``, or
    ``break`` statement.

[3] A string literal appearing as the first statement in the function
    body is transformed into the function's ``__doc__`` attribute and
    therefore the function's *docstring*.

[4] A string literal appearing as the first statement in the class
    body is transformed into the namespace's ``__doc__`` item and
    therefore the class's *docstring*.

Related help topics: CLASSES, SPECIALMETHODS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant