# HG changeset patch # User paulb@localhost.localdomain # Date 1163544141 -3600 # Node ID 1e13a8230404b5b057043022f02aec2a33d979cb # Parent 358247608f6b4e39f95fded073512a76b3ddfc6d Improved/added tests of logical operators. Renamed the string class to str, eliminating the str built-in function. diff -r 358247608f6b -r 1e13a8230404 lib/builtins.py --- a/lib/builtins.py Tue Nov 14 23:41:45 2006 +0100 +++ b/lib/builtins.py Tue Nov 14 23:42:21 2006 +0100 @@ -448,7 +448,10 @@ def __true__(self): return self != 0 -class string: +class str: + def __init__(self, x=None): + x.__str__() + def __add__(self, other): if isinstance(other, string): return string() @@ -798,9 +801,6 @@ i -= 1 return result -def str(x): - return x.__str__() - # Special values. None of these definitions should be generated by the compiler. # All such definitions should be made in the underlying implementation. diff -r 358247608f6b -r 1e13a8230404 tests/logical.py --- a/tests/logical.py Tue Nov 14 23:41:45 2006 +0100 +++ b/tests/logical.py Tue Nov 14 23:42:21 2006 +0100 @@ -1,1 +1,5 @@ +x = 1 +y = "2" +b = 3.0 +c = 4 a = x and y or b and not c diff -r 358247608f6b -r 1e13a8230404 tests/logical_attr.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/logical_attr.py Tue Nov 14 23:42:21 2006 +0100 @@ -0,0 +1,10 @@ +class X: + x = 1 +class Y: + y = "2" +class B: + b = 3.0 +class C: + c = 4 +a = X() and Y() or B() and not C() +b = a.x and a.y or a.b and not a.c