1- from __future__ import print_function
21"""xferfcn.py
32
43Transfer function representation and functions.
3534
3635"""
3736
37+ # Python 3 compatability (needs to go here)
38+ from __future__ import print_function
39+
3840"""Copyright (c) 2010 by California Institute of Technology
3941All rights reserved.
4042
@@ -142,15 +144,15 @@ def __init__(self, *args):
142144 # this is a shallow copy! This should be okay, but be careful.
143145 data = [num , den ]
144146 for i in range (len (data )):
145- if isinstance (data [i ], (int , float , long , complex )):
147+ if isinstance (data [i ], (int , float , complex )):
146148 # Convert scalar to list of list of array.
147149 if (isinstance (data [i ], int )):
148150 # Convert integers to floats at this point
149151 data [i ] = [[array ([data [i ]], dtype = float )]]
150152 else :
151153 data [i ] = [[array ([data [i ]])]]
152154 elif (isinstance (data [i ], (list , tuple , ndarray )) and
153- isinstance (data [i ][0 ], (int , float , long , complex ))):
155+ isinstance (data [i ][0 ], (int , float , complex ))):
154156 # Convert array to list of list of array.
155157 if (isinstance (data [i ][0 ], int )):
156158 # Convert integers to floats at this point
@@ -161,7 +163,7 @@ def __init__(self, *args):
161163 elif (isinstance (data [i ], list ) and
162164 isinstance (data [i ][0 ], list ) and
163165 isinstance (data [i ][0 ][0 ], (list , tuple , ndarray )) and
164- isinstance (data [i ][0 ][0 ][0 ], (int , float , long , complex ))):
166+ isinstance (data [i ][0 ][0 ][0 ], (int , float , complex ))):
165167 # We might already have the right format. Convert the
166168 # coefficient vectors to arrays, if necessary.
167169 for j in range (len (data [i ])):
@@ -362,7 +364,7 @@ def __mul__(self, other):
362364 """Multiply two LTI objects (serial connection)."""
363365
364366 # Convert the second argument to a transfer function.
365- if isinstance (other , (int , float , long , complex )):
367+ if isinstance (other , (int , float , complex )):
366368 other = _convertToTransferFunction (other , inputs = self .inputs ,
367369 outputs = self .inputs )
368370 else :
@@ -412,7 +414,7 @@ def __rmul__(self, other):
412414 def __div__ (self , other ):
413415 """Divide two LTI objects."""
414416
415- if isinstance (other , (int , float , long , complex )):
417+ if isinstance (other , (int , float , complex )):
416418 other = _convertToTransferFunction (other , inputs = self .inputs ,
417419 outputs = self .inputs )
418420 else :
@@ -440,7 +442,7 @@ def __div__(self, other):
440442 # TODO: Division of MIMO transfer function objects is not written yet.
441443 def __rdiv__ (self , other ):
442444 """Right divide two LTI objects."""
443- if isinstance (other , (int , float , long , complex )):
445+ if isinstance (other , (int , float , complex )):
444446 other = _convertToTransferFunction (other , inputs = self .inputs ,
445447 outputs = self .inputs )
446448 else :
@@ -906,7 +908,7 @@ def _convertToTransferFunction(sys, **kw):
906908
907909 return TransferFunction (num , den , sys .dt )
908910
909- elif isinstance (sys , (int , long , float , complex )):
911+ elif isinstance (sys , (int , float , complex )):
910912 if "inputs" in kw :
911913 inputs = kw ["inputs" ]
912914 else :
0 commit comments