TF-AT Course 1 week4

Hi everyone
Excuse me. I could not understand why should we refer to the name of the class in the first argument of super() function.
super(IdentityBlock, self).init(name=’’)

Hi @saiman!

It is a builtin issue from Python language, it is used to specify the type that the object self would be when instantiating it.
For example, if I am coding a PositiveInteger class and that extends an Integer class, when I call the super function I would specify with the first argument that I want the object self (second argument) to be of type PositiveInteger to let the Python interpreter know.

I hope I’ve helped, if you have any other question feel free to ask here on Discourse.
Thank you!

Hi @gonzalogomezn

Thanks for your answer.

I wonder why should it be necessary when we are in the child class and completely aware of who is inheriting the parent class.

I have seen a lot of examples that super is used in super().init(). in fact I am a bit confused.

would you mind provide me some useful links.

thanks for you patience :pray:

Hello again @saiman,

Yes! no problem, I can send you this StackOverflow thread where they discuss this python issue:

Anyways this is a Python 2 thing, if you use Python 3 it should let you write just super().init() with no arguments :slight_smile: as it takes the name of the class by default.

2 Likes