0

I am unable to use super in Python 2.7.9; is it possible to use it? Code I have been trying:

class Base():
   def __init__(self):
      print "It's a Base"
class Secondary(Base):
   def __init__(self):
      super(Secondary,self).__init__()
Secondary()

Error:

Must be type not classobj
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Newbee
  • 45
  • 1
  • 9
  • 2
    Your `Base()` should be `Base(object)`. – 9000 May 14 '15 at 14:52
  • Please help me understand why Base(object) and not empty braces. – Newbee May 14 '15 at 14:56
  • 2
    @Newbee the latter creates an *"old-style"* classes, the former a *"new-style"* class - see e.g. http://stackoverflow.com/q/54867/3001761. Note also that this *is* covered in the duplicate - have you read it? – jonrsharpe May 14 '15 at 14:58
  • Thanks a lot for your answer .I've got the solution and also the explanation. – Newbee May 14 '15 at 15:02

0 Answers0