Chapter 7: The Preprocessor

Example 7.1, page no. 215

In [1]:
def DOUBLE(x):
    return x+x

print "%d\n" %(DOUBLE(1))
2

Example 7.2, page no. 217

In [2]:
def TEST(x):
    if(not (x)):
        print "test failed.... "
    else:
        print "Test passed..."

TEST(23)
Test passed...

Example 7.3, page no. 220

In [3]:
ULONG_MAX = 4294967295 # MAX LIMIT OF LONG IN C LANG.
if ULONG_MAX+1 != 0:
    print "Preprocessor: ULONG_MAX+1 != 0\n"
if ULONG_MAX+1 != 0:
    print "Runtime: ULONG_MAX+1 != 0\n"
Preprocessor: ULONG_MAX+1 != 0

Runtime: ULONG_MAX+1 != 0