Re: [Tutor] How arguments to the super() function works?

2019-05-19 Thread Mats Wichmann
On 5/19/19 12:28 AM, Arup Rakshit wrote: > >> On 19-May-2019, at 4:46 AM, Mark Lawrence wrote: >> >> On 18/05/2019 17:21, Arup Rakshit wrote: >>> I am writing an Flask app following a book, where a piece of python concept >>> I am not getting how it works. Code is: >>> class Role(db.Model): >>>

Re: [Tutor] How arguments to the super() function works?

2019-05-19 Thread eryk sun
On 5/19/19, Arup Rakshit wrote: > > class Dad: > def can_i_take_your_car(self): > print("No...") > > class Mom(Dad): > def can_i_take_your_car(self): > print("Asking your dad...") > > class Victor(Mom, Dad): > def can_i_take_your_car(self): > print("Asking

Re: [Tutor] How arguments to the super() function works?

2019-05-19 Thread Arup Rakshit
> On 19-May-2019, at 4:46 AM, Mark Lawrence wrote: > > On 18/05/2019 17:21, Arup Rakshit wrote: >> I am writing an Flask app following a book, where a piece of python concept >> I am not getting how it works. Code is: >> class Role(db.Model): >> __tablename__ = 'roles' >> id =

Re: [Tutor] How arguments to the super() function works?

2019-05-18 Thread Steven D'Aprano
On Sat, May 18, 2019 at 09:51:39PM +0530, Arup Rakshit wrote: > Here, why super(Role, self).__init__(**kwargs) is used instead of > super().__init__(**kwargs) ? What that Role and self argument is > instructing the super() ? The Role and self arguments are the owning class and current

Re: [Tutor] How arguments to the super() function works?

2019-05-18 Thread Mark Lawrence
On 18/05/2019 17:21, Arup Rakshit wrote: I am writing an Flask app following a book, where a piece of python concept I am not getting how it works. Code is: class Role(db.Model): __tablename__ = 'roles' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64),

Re: [Tutor] How arguments to the super() function works?

2019-05-18 Thread Alan Gauld via Tutor
On 18/05/2019 17:21, Arup Rakshit wrote: > class Role(db.Model): > > def __init__(self, **kwargs): > super(Role, self).__init__(**kwargs) > > Here, why super(Role, self).__init__(**kwargs) is used instead > of super().__init__(**kwargs) ? I suspect you are reading an older

[Tutor] How arguments to the super() function works?

2019-05-18 Thread Arup Rakshit
I am writing an Flask app following a book, where a piece of python concept I am not getting how it works. Code is: class Role(db.Model): __tablename__ = 'roles' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), unique=True) default =