Skip to content

Commit 1c9472a

Browse files
committed
Replace asserts with comments in example code
Should be less confusing for newbies (as the assert is not actually required). (someone asked this on irc: `17:54 <karlpinc> ionelmc: Good point. Regards choice 3, the exec choice, I don't understand why the example code includes an assert statement.`)
1 parent db415b2 commit 1c9472a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/single_source_version.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ There are a few techniques to store the version in your project code without dup
5656
::
5757

5858
execfile('...sample/version.py')
59-
assert __version__ == '1.2.0'
59+
# now we have a `__version__` variable
60+
# later on we use: __version__
6061

6162
Using ``exec``:
6263

@@ -65,7 +66,7 @@ There are a few techniques to store the version in your project code without dup
6566
version = {}
6667
with open("...sample/version.py") as fp:
6768
exec(fp.read(), version)
68-
assert version['__version__'] == '1.2.0'
69+
# later on we use: version['__version__']
6970

7071
Example using this technique: `warehouse <https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py>`_.
7172

0 commit comments

Comments
 (0)