mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 14:50:19 +00:00
Fix uppercase after semicolon
This commit is contained in:
@@ -19,7 +19,7 @@ Easy structuring of a project means it is also easy
|
||||
to do it poorly. Some signs of a poorly structured project
|
||||
include:
|
||||
|
||||
- Multiple and messy circular dependencies: If your classes
|
||||
- Multiple and messy circular dependencies: if your classes
|
||||
Table and Chair in furn.py need to import Carpenter from workers.py
|
||||
to answer a question such as table.isdoneby(),
|
||||
and if conversely the class Carpenter needs to import Table and Chair,
|
||||
@@ -28,13 +28,13 @@ include:
|
||||
fragile hacks such has using import statements inside
|
||||
methods or functions.
|
||||
|
||||
- Hidden coupling: Each and every change in Table's implementation
|
||||
- Hidden coupling: each and every change in Table's implementation
|
||||
breaks 20 tests in unrelated test cases because it breaks Carpenter's code,
|
||||
which requires very careful surgery to adapt the change. This means
|
||||
you have too many assumptions about Table in Carpenter's code or the
|
||||
reverse.
|
||||
|
||||
- Heavy usage of global state or context: Instead of explicitly
|
||||
- Heavy usage of global state or context: instead of explicitly
|
||||
passing ``(height, width, type, wood)`` to each other, Table
|
||||
and Carpenter rely on global variables that can be modified
|
||||
and are modified on the fly by different agents. You need to
|
||||
@@ -43,14 +43,14 @@ include:
|
||||
template code is also modifying this context, messing with
|
||||
table dimensions.
|
||||
|
||||
- Spaghetti code: Multiple pages of nested if clauses and for loops
|
||||
- Spaghetti code: multiple pages of nested if clauses and for loops
|
||||
with a lot of copy-pasted procedural code and no
|
||||
proper segmentation are known as spaghetti code. Python's
|
||||
proper segmentation are known as spaghetti code. Python's
|
||||
meaningful indentation (one of its most controversial features) make
|
||||
it very hard to maintain this kind of code. So the good news is that
|
||||
you might not see too much of it.
|
||||
|
||||
- Ravioli code is more likely in Python: It consists of hundreds of
|
||||
- Ravioli code is more likely in Python: it consists of hundreds of
|
||||
similar little pieces of logic, often classes or objects, without
|
||||
proper structure. If you never can remember if you have to use
|
||||
FurnitureTable, AssetTable or Table, or even TableNew for your
|
||||
|
||||
@@ -186,7 +186,7 @@ We are all consenting adults
|
||||
|
||||
As seen above, Python allows many tricks, and some of them are potentially
|
||||
dangerous. A good example is that any client code can override an object's
|
||||
properties and methods: There is no "private" keyword in Python. This
|
||||
properties and methods: there is no "private" keyword in Python. This
|
||||
philosophy, very different from highly defensive languages like Java, which
|
||||
give a lot of mechanism to prevent any misuse, is expressed by the saying: "We
|
||||
are consenting adults".
|
||||
|
||||
Reference in New Issue
Block a user