what does super() do without any arguments?

In ES6, derived classes have to call super() if they have a constructor. In react, all components extend from the Component class. You don’t actually need a constructor for every ES6/react class. If no custom constructor is defined, it will use the default constructor. For base classes, it is: constructor() {} And for derived classes, … Read more

What’s the difference between super() and Parent class name?

Not in this case. But in general, and especially when you use multiple inheritance, super() delegates to the next object in the Method Resolution Order (MRO) as is specified in the documentation: super([type[, object-or-type]]) Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing … Read more

Python super() behavior not dependable

Are you reloading modules somehow in the middle of things? If so, that may explain this error. isinstance(self,DBAdminConnection) may become false after reloading modules because of the changes to memory references, apparently. Edit: if you’re running your web.py app under mod_wsgi, make sure you’re disabling autoreload: app = web.application(urls, globals(), autoreload=False)

In python, super() is always called first in a method. Are there situations where it should be called later?

Sometimes you need to validate the arguments before calling super(): class UpperBase(Base): def __init__(self, name): if not name_valid(name): raise ValueError() super(UpperBase, self).__init__(name) I don’t see why this wouldn’t be pythonic, because it’s the easiest way to do it and it’s straightforward. Also, read @JHSaunders’ comment, he makes a good point.

What exactly is super in Objective-C?

super Essentially, it allows you to use the implementations of the current class’ superclass. For the gritty details of the Objective-C runtime: [super message] has the following meaning: When it encounters a method call, the compiler generates a call to one of the functions objc_msgSend, objc_msgSend_stret, objc_msgSendSuper, or objc_msgSendSuper_stret. Messages sent to an object’s superclass … Read more