Horje
python how to extend a class Code Example
python how to extend a class
# there is no extend keyword used in Python
# line #7 below is equivalent to "class Circle extends Shape" (in JAVA)

class Shape(object):
   pass

class Circle(Shape):   # in python we use superclass as arg to EXTEND Shape
   pass 

s = Shape()
c = Circle()
print(isinstance(s, Shape))
print(isinstance(c, Circle))
print(isinstance(c, Shape))
print(isinstance(s, Circle))
#  
# output
# True (s is an instance of Shape )
# True (c is an instance of Circle )
# True (c is also an instance of Shape )
# False (s is NOT an instance of Circle because Shape is a subclass )




Python

Related
Get the positions of items of ser2 in ser1 as a list python Code Example Get the positions of items of ser2 in ser1 as a list python Code Example
how to use rbind() to combine dataframes Code Example how to use rbind() to combine dataframes Code Example
how to remove repeated files from google drive in python Code Example how to remove repeated files from google drive in python Code Example
Group the values for each key in the RDD into a single sequence. Code Example Group the values for each key in the RDD into a single sequence. Code Example
command errored out with exit status 1: Code Example command errored out with exit status 1: Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8