diff --git a/cppguide.xml b/cppguide.xml index 507a569..c335fc7 100644 --- a/cppguide.xml +++ b/cppguide.xml @@ -4,7 +4,7 @@
-Revision 3.178 +Revision 3.180
@@ -739,9 +739,11 @@ Tashana Landray particular, initialization should be used instead of declaration and assignment, e.g. -@@ -3018,7 +3020,7 @@ Tashana Landray Please see the description of macros; in general macros should not be used. However, if they are absolutely needed, then they should be - named like enum value names with all capitals and underscores. + named with all capitals and underscores.
-Revision 3.178 +Revision 3.180
diff --git a/pyguide.html b/pyguide.html index 23939e1..b2db3f7 100644 --- a/pyguide.html +++ b/pyguide.html @@ -100,7 +100,7 @@- Revision 2.15 + Revision 2.18
@@ -262,35 +262,38 @@
Pros:
- Simplest and most commonly used way of sharing things.
+ The namespace management convention is simple. The source of each
+ identifier is indicated in a consistent way; x.Obj
says
+ that object Obj
is defined in module x
.
-Cons: from foo import *
or
- from foo import Bar
is
- very nasty and can lead to serious maintenance issues because
- it makes it hard to find module dependencies.
+Cons: Module names can still collide. Some module names are
+ inconveniently long.
Decision:
- Use import x
for importing packages and modules.
- Use from x import y
only when x
is a
- package and y
is a module. This allows the
- importer to refer to the module without specifying the full
- package prefix. For example the module
- sound.effects.echo
may be imported as follows:
+ Use import x
for importing packages and modules.
+
+ Use from x import y
where x
is
+ the package prefix and y
is the module name with no
+ prefix.
+
+ Use from x import y as z
if two modules named
+ z
are to be imported or if y
is an
+ inconveniently long name.
sound.effects.echo
may be imported as follows:
from sound.effects import echo ... -echo.echofilter(input, output, delay=0.7, atten=4) +echo.EchoFilter(input, output, delay=0.7, atten=4)
- Even if the module is in the same package, do not directly import - the module without the full package name. This might cause the - package to be imported twice (with unintended side effects) when the - "main" module that is used to start an application lives inside a - package (and uses modules from that same package). + Do not use relative names in imports. Even if the module is in the + same package, use the full package name. This helps prevent + unintentionally importing a package twice.
@@ -300,8 +303,7 @@ link/usr/bin/python2.4
, not
/usr/bin/python2
. This makes it easier to find
- dependencies when
-
- upgrading to a different Python version
+ dependencies when upgrading to a different Python version
and also avoids confusion and breakage during use. E.g., Does
- /usr/bin/python2
mean Python 2.0.1 or Python
- 2.3.0?
+ /usr/bin/python2
mean Python 2.0.1 or Python 2.3.0?
-Revision 2.15 +Revision 2.18
diff --git a/styleguide.xsl b/styleguide.xsl index e82e8f1..38345d5 100644 --- a/styleguide.xsl +++ b/styleguide.xsl @@ -449,7 +449,9 @@ xmlns:fn="http://www.w3.org/2005/xpath-functions"> Substitutes underscore for characters unsuitable for URLs -->