mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 14:50:19 +00:00
Changed python into Python where needed
This commit is contained in:
@@ -17,7 +17,7 @@ assuming the user knows anything about the project), the url of the
|
||||
main source for the software, and some basic credit information. This
|
||||
file is the main entry point for readers of the code.
|
||||
|
||||
An :file:`INSTALL` file is less necessary with python. The installation
|
||||
An :file:`INSTALL` file is less necessary with Python. The installation
|
||||
instructions are often reduced to one command, such as ``pip install
|
||||
module`` or ``python setup.py install`` and added to the :file:`README`
|
||||
file.
|
||||
@@ -56,7 +56,7 @@ of the following components:
|
||||
Sphinx
|
||||
~~~~~~
|
||||
|
||||
Sphinx_ is far and away the most popular python documentation
|
||||
Sphinx_ is far and away the most popular Python documentation
|
||||
tool. **Use it.** It converts :ref:`restructuredtext-ref` markup language
|
||||
into a range of output formats including HTML, LaTeX (for printable
|
||||
PDF versions), manual pages, and plain text.
|
||||
|
||||
@@ -31,7 +31,7 @@ To help you choose one for your project, there's a `license chooser <http://thre
|
||||
|
||||
**More Permissive**
|
||||
|
||||
- PSFL (Python Software Foundation License) -- for contributing to python itself
|
||||
- PSFL (Python Software Foundation License) -- for contributing to Python itself
|
||||
- MIT / BSD / ISC
|
||||
|
||||
+ MIT (X11)
|
||||
|
||||
@@ -92,12 +92,12 @@ environment, or your project's internal modules.
|
||||
To keep in line with the style guide, keep module names short, lowercase, and
|
||||
be sure to avoid using special symbols like the dot (.) or question mark (?).
|
||||
So a file name like :file:`my.spam.py` is one you should avoid! Naming this way
|
||||
will interfere with the way python looks for modules.
|
||||
will interfere with the way Python looks for modules.
|
||||
|
||||
In the case of `my.spam.py` python expects to find a :file:`spam.py` file in a folder named :file:`my`
|
||||
In the case of `my.spam.py` Python expects to find a :file:`spam.py` file in a folder named :file:`my`
|
||||
which is not the case. There is an
|
||||
`example <http://docs.python.org/tutorial/modules.html#packages>`_ of how the
|
||||
dot notation should be used in the python docs.
|
||||
dot notation should be used in the Python docs.
|
||||
|
||||
If you'd like you could name it as :file:`my_spam.py` but even our friend the
|
||||
underscore should not be seen often in module names.
|
||||
|
||||
@@ -360,7 +360,7 @@ Take the following code for example:
|
||||
def lookup_list(l):
|
||||
return 's' in l
|
||||
|
||||
Even though both functions look identical, because *lookup_dict* is utilizing the fact that dictionaries in python are hashtables, the lookup performance between the two is very different.
|
||||
Even though both functions look identical, because *lookup_dict* is utilizing the fact that dictionaries in Python are hashtables, the lookup performance between the two is very different.
|
||||
Python will have to go through each item in the list to find a matching case, which is time consuming. By analysing the hash of the dictionary, finding keys in the dict can be done very quickly.
|
||||
For more information see this `StackOverflow <http://stackoverflow.com/questions/513882/python-list-vs-dict-for-look-up-table>`_ page.
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ to newer versions of the module easier in the future
|
||||
class MyTest(unittest.TestCase):
|
||||
...
|
||||
|
||||
This way if you ever switch to a newer python version and no longer need the
|
||||
This way if you ever switch to a newer Python version and no longer need the
|
||||
unittest2 module, you can simply change the import in your test module without
|
||||
the need to change any other code.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user