In article <fucrivcvd2mel7k51ij1hktb55gqnmk9ic at 4ax.com>, Daniel Klein wrote:
In Python 2.2 I use to have
true = (1 == 1)
false = not true
This was at the recommendation of someone on this list some time ago.
The reason (if I remember correctly) was that setting
true = 1
false = 0
were not true booleans.
Now the expression (1 == 1) returns 'True', and caused a bug in my
Actually, it returns True, not 'True'
code. So my question is what is the proper method for setting booleans
in 2.3?
Really confused,
True and False are now built in to 2.3
python
Python 2.3 (#1, Aug 1 2003, 15:18:54)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
['ArithmeticError', 'AssertionError', 'AttributeError', 'DeprecationWarning',
'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception',
'False', .snip. 'True', .snip.
'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
but I think if you had an up-to-date 2.2 they should have been there too...
python2.2
Python 2.2.3 (#1, Jun 9 2003, 18:01:50)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
['ArithmeticError', 'AssertionError', 'AttributeError', 'DeprecationWarning',
'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception',
'False', .snip. 'True', .snip.
'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
What error are you getting? How are you using true and false?
I know the developers were very careful to not cause any compatibilty
problems with the addition of booleans.