[Tutor] Dots-And-Boxes
Kalle Svensson
kalle@lysator.liu.se
Sun, 2 Jun 2002 18:45:42 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[I wrote about assert statements]
> __debug__ is always true if you haven't started python with the -O
> option. For example:
>
> : kalle@chloe [~]$ ; python -O -c "assert 0; print 'Hi'"
> Hi
> : kalle@chloe [~]$ ; python -c "assert 0; print 'Hi'"
> Traceback (most recent call last):
> File "<string>", line 1, in ?
> AssertionError
Note, though:
: kalle@chloe [~]$ ; python -c "__debug__ = 0; assert 0; print 'Hi'"
<string>:0: SyntaxWarning: can not assign to __debug__
Hi
: kalle@chloe [~]$ ; python -V
Python 2.1.3
That is, __debug__ can be assigned to in Python 2.1.3 (and earlier),
but it will raise a SyntaxWarning (in 2.1.x).
: kalle@chloe [~]$ ; python2.2 -c "__debug__ = 0; assert 0; print 'Hi'"
File "<string>", line 1
SyntaxError: can not assign to __debug__
: kalle@chloe [~]$ ; python2.2 -V
Python 2.2.1
In Python 2.2 it is no longer possible to assign to __debug__.
Peace,
Kalle
- --
Kalle Svensson, http://www.juckapan.org/~kalle/
Student, root and saint in the Church of Emacs.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>
iD8DBQE8+kuzdNeA1787sd0RAmpoAJ9dm8Ig+rNHkSisVxcBaIlAqAwkFQCfd/01
Q/jm/jAdVPccrw4+Eq1EdNc=
=WxjD
-----END PGP SIGNATURE-----