mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Fixed all H2 headings
Before, H2 fomratting was not consistent. Now, all H2 headings use over/under asterisks.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
|
||||
|
||||
##############
|
||||
Common Gotchas
|
||||
==============
|
||||
##############
|
||||
|
||||
.. image:: /_static/photos/34435688380_b5a740762b_k_d.jpg
|
||||
|
||||
@@ -16,8 +19,10 @@ the surprise.
|
||||
|
||||
.. _default_args:
|
||||
|
||||
|
||||
*************************
|
||||
Mutable Default Arguments
|
||||
-------------------------
|
||||
*************************
|
||||
|
||||
Seemingly the *most* common surprise new Python programmers encounter is
|
||||
Python's treatment of mutable default arguments in function definitions.
|
||||
@@ -88,8 +93,9 @@ to maintain state between calls of a function. This is often done when writing
|
||||
a caching function.
|
||||
|
||||
|
||||
****************************
|
||||
Late Binding Closures
|
||||
---------------------
|
||||
****************************
|
||||
|
||||
Another common source of confusion is the way Python binds its variables in
|
||||
closures (or in the surrounding global scope).
|
||||
@@ -189,9 +195,9 @@ lots of situations. Looping to create unique functions is unfortunately a case
|
||||
where they can cause hiccups.
|
||||
|
||||
|
||||
|
||||
*********************************
|
||||
Bytecode (.pyc) Files Everywhere!
|
||||
---------------------------------
|
||||
*********************************
|
||||
|
||||
By default, when executing Python code from files, the Python interpreter
|
||||
will automatically write a bytecode version of that file to disk, e.g.
|
||||
|
||||
Reference in New Issue
Block a user