mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Fixed the urls pointing to contribute and fixed some lines that were
longer than 78 characters.
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ How to contribute
|
|||||||
This guide is under heavy development. If you would like to contribute, please
|
This guide is under heavy development. If you would like to contribute, please
|
||||||
see:
|
see:
|
||||||
|
|
||||||
http://python-guide.readthedocs.org/en/latest/notes/contribute.html
|
http://docs.python-guide.org/en/latest/notes/contribute.html
|
||||||
|
|
||||||
|
|
||||||
Style Guide
|
Style Guide
|
||||||
|
|||||||
Vendored
+1
-1
@@ -23,7 +23,7 @@
|
|||||||
This guide is the result of the collaboration of
|
This guide is the result of the collaboration of
|
||||||
<a href="https://github.com/kennethreitz/python-guide/graphs/contributors">135+ people</a>
|
<a href="https://github.com/kennethreitz/python-guide/graphs/contributors">135+ people</a>
|
||||||
around the world, and your contributions
|
around the world, and your contributions
|
||||||
<a href="http://python-guide.readthedocs.org/en/latest/notes/contribute.html">are welcome</a>!
|
<a href="http://docs.python-guide.org/en/latest/notes/contribute.html">are welcome</a>!
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ of the following components:
|
|||||||
done with the product, using one or two extremely simplified use
|
done with the product, using one or two extremely simplified use
|
||||||
cases. This is the thirty-second pitch for your project.
|
cases. This is the thirty-second pitch for your project.
|
||||||
|
|
||||||
- A *tutorial* should show some primary use cases in more detail. The reader will
|
- A *tutorial* should show some primary use cases in more detail. The reader
|
||||||
follow a step-by-step procedure to set-up a working prototype.
|
will follow a step-by-step procedure to set-up a working prototype.
|
||||||
|
|
||||||
- An *API reference* is typically generated from the code (see
|
- An *API reference* is typically generated from the code (see
|
||||||
:ref:`docstrings <docstring-ref>`). It will list all publicly available interfaces,
|
:ref:`docstrings <docstring-ref>`). It will list all publicly available
|
||||||
parameters, and return values.
|
interfaces, parameters, and return values.
|
||||||
|
|
||||||
- *Developer documentation* is intended for potential contributors. This can
|
- *Developer documentation* is intended for potential contributors. This can
|
||||||
include code convention and general design strategy of the project.
|
include code convention and general design strategy of the project.
|
||||||
@@ -107,7 +107,8 @@ In Python, *docstrings* describe modules, classes, and functions:
|
|||||||
"""Returns the square root of self times self."""
|
"""Returns the square root of self times self."""
|
||||||
...
|
...
|
||||||
|
|
||||||
In general, follow the comment section of :pep:`8#comments` (the "Python Style Guide").
|
In general, follow the comment section of :pep:`8#comments` (the "Python Style
|
||||||
|
Guide").
|
||||||
|
|
||||||
Commenting Sections of Code
|
Commenting Sections of Code
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ avoids surprises. However, there are a few cases that can be confusing to
|
|||||||
newcomers.
|
newcomers.
|
||||||
|
|
||||||
Some of these cases are intentional but can be potentially surprising. Some
|
Some of these cases are intentional but can be potentially surprising. Some
|
||||||
could arguably be considered language warts. In general though, what follows is a collection
|
could arguably be considered language warts. In general though, what follows
|
||||||
of potentially tricky behavior that might seem strange at first glance, but is
|
is a collection of potentially tricky behavior that might seem strange at first
|
||||||
generally sensible once you're aware of the underlying cause for the surprise.
|
glance, but is generally sensible once you're aware of the underlying cause for
|
||||||
|
the surprise.
|
||||||
|
|
||||||
|
|
||||||
.. _default_args:
|
.. _default_args:
|
||||||
@@ -139,7 +140,8 @@ completed and ``i`` is left with its final value of 4.
|
|||||||
What's particularly nasty about this gotcha is the seemingly prevalent
|
What's particularly nasty about this gotcha is the seemingly prevalent
|
||||||
misinformation that this has something to do with :ref:`lambdas <python:lambda>`
|
misinformation that this has something to do with :ref:`lambdas <python:lambda>`
|
||||||
in Python. Functions created with a ``lambda`` expression are in no way special,
|
in Python. Functions created with a ``lambda`` expression are in no way special,
|
||||||
and in fact the same exact behavior is exhibited by just using an ordinary ``def``:
|
and in fact the same exact behavior is exhibited by just using an ordinary
|
||||||
|
``def``:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -179,6 +181,6 @@ Alternatively, you can use the functools.partial function:
|
|||||||
When the Gotcha Isn't a Gotcha
|
When the Gotcha Isn't a Gotcha
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Sometimes you want your closures to behave this way. Late binding is good in lots of
|
Sometimes you want your closures to behave this way. Late binding is good in
|
||||||
situations. Looping to create unique functions is unfortunately a case where
|
lots of situations. Looping to create unique functions is unfortunately a case
|
||||||
they can cause hiccups.
|
where they can cause hiccups.
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ To help you choose one for your project, there's a `license chooser <http://choo
|
|||||||
+ GPLv2
|
+ GPLv2
|
||||||
+ GPLv3
|
+ GPLv3
|
||||||
|
|
||||||
A good overview of licenses with explanations of what one can, cannot, and must do using a particular software can be found at `tl;drLegal <https://tldrlegal.com/>`_.
|
A good overview of licenses with explanations of what one can, cannot,
|
||||||
|
and must do using a particular software can be found at
|
||||||
|
`tl;drLegal <https://tldrlegal.com/>`_.
|
||||||
|
|||||||
Reference in New Issue
Block a user