large = 456789; # Potentially dangerous conversion
size = float(large)
print size
class DangerousString :
def __init__(self):
pass # self.s = ''
def __str__(self):
pass # return self.s
large = 456789
size = int(large);
three = "three"
print large,size,three
class B:
pass
class D( B):
pass
class E:
pass
def dynamicCast(b):
return D(b)
def constCast(d1):
return D(d1)
def reinterpretCast(d):
return E(d)
def addToFileList(s):
pass
def addFiles(s):
m = len(s)
for i in range(m):
addToFileList(s[i])
ci = 22;
pi = ci # NO: Const cast away
i = pi; # OK
pi = 7
print ci, pi, i
class EmcMatrix:
def __init__(self):
self.isDirtyM = False
self.detM = 0.0
def calculateDeterminant(self):
pass
def determinant(self):
if(isDirtyM):
# OK, access to mutable data members
self.detM = self.calculateDeterminant();
self.isDirtyM = False;
return self.detM;