mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Clarifying a bit on commented code
This commit is contained in:
@@ -104,26 +104,38 @@ line. Good editors allow to do this with few keystrokes (ctrl-v on Vim).
|
|||||||
|
|
||||||
def tricky_function():
|
def tricky_function():
|
||||||
'''
|
'''
|
||||||
|
Commented out because its breaks something.
|
||||||
if foo:
|
if foo:
|
||||||
do_bar()
|
do_bar()
|
||||||
'''
|
'''
|
||||||
return baz
|
return baz
|
||||||
|
|
||||||
def tricky_function():
|
def tricky_function():
|
||||||
|
# Commented out because its breaks something.
|
||||||
#if foo:
|
#if foo:
|
||||||
#do_bar()
|
#do_bar()
|
||||||
return baz
|
return baz
|
||||||
|
|
||||||
|
|
||||||
|
def tricky_function():
|
||||||
|
# Commented out because its breaks something.
|
||||||
|
# if foo:
|
||||||
|
# do_bar()
|
||||||
|
return baz
|
||||||
|
|
||||||
**Good**
|
**Good**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def tricky_function():
|
def tricky_function():
|
||||||
|
# Commented out because its breaks something.
|
||||||
#if foo:
|
#if foo:
|
||||||
# do_bar()
|
# do_bar()
|
||||||
return baz
|
return baz
|
||||||
|
|
||||||
|
Note that comment text is properly written and separated from the hash by a
|
||||||
|
space. Commented code is not separated from the hash by an additional space;
|
||||||
|
this helps when uncommented the code.
|
||||||
|
|
||||||
The Basics
|
The Basics
|
||||||
::::::::::
|
::::::::::
|
||||||
|
|||||||
Reference in New Issue
Block a user