Chapter Nine : Static Objects

EXAMPLE 9.1 page no : 97

In [1]:
def randomValue(seed):
    oldValue = seed; # calculate new value
    return oldValue
    
print randomValue(5)    
5

EXAMPLE 9.2 page no : 97

In [6]:
class EmcSingleton:
    def instance():
        pass
    
    def create(i = 0):
        self.instanceM = EmcSingleton(i)

    def __init__(self,i):
        pass

EXAMPLE 9.3 page no : 98

In [7]:
sccsid = "@(#)myfile.cc"
print sccsid
@(#)myfile.cc

EXAMPLE 9.4 page no : 98

In [8]:
sccsid = "@(#)myfile.cc"
print sccsid
@(#)myfile.cc

EXAMPLE 9.5 page no : 98

In [10]:
class EmcLog:
    def __init__(self,out=None):
        print "Creating log"

t = EmcLog()
Creating log

EXAMPLE 9.6 page no : 100

In [11]:
sccsid = "@(#)myfile.cc"
release = "@(#)Emc Class Library, 1.2"
print sccsid, release
@(#)myfile.cc @(#)Emc Class Library, 1.2

EXAMPLE 9.7 page no : 100

In [12]:
class EmcObject:
    def __init__(self):
        pass
    
    def __del__(self):
        pass
        
    def initialize(self):
        pass
        
    def finalize(self):
        pass
In [ ]: