When to use super type in python

0 votes
When can I use super(type)? Not super(type,obj) but super(type) - with one argument.
Jun 3, 2019 in Python by ana1504.k
• 7,910 points
561 views

1 answer to this question.

0 votes
super(x) returns an "unbound" descriptor, that is, an object that knows how to get data, but has no idea where. If you assign super(x) to a class attribute and then retrieve it, the descriptor machinery cares for proper binding:

class A(object):
    def foo(self):
        print 'parent'

class B(A):
    def foo(self):
        print 'child'

B.parent = super(B)
B().foo()
B().parent.foo()
answered Jun 3, 2019 by SDeb
• 13,300 points

Related Questions In Python

0 votes
1 answer

When to use %r instead of %s in Python? [duplicate]

The %s specifier converts the object using ...READ MORE

answered Aug 2, 2018 in Python by bug_seeker
• 15,520 points
824 views
0 votes
1 answer

When is the perfect time to use Tornado in python?

There is a server and a webframework. ...READ MORE

answered Feb 14, 2019 in Python by aryya
• 7,450 points
1,262 views
0 votes
1 answer

When to use "while" or "for" in Python?

while and for are both flow control ...READ MORE

answered Feb 9, 2022 in Python by Nandini
• 5,480 points
225 views
0 votes
1 answer

When to use "while" or "for" in Python

Yes, there is a significant distinction between ...READ MORE

answered Feb 9, 2022 in Python by CoolCoder
• 4,400 points
268 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,007 views
0 votes
1 answer
0 votes
1 answer

When to use file vs open in Python?

File() has been removed since Python 3.0 ...READ MORE

answered Oct 30, 2018 in Python by SDeb
• 13,300 points
1,040 views
0 votes
1 answer

How to use multiprocessing queue in Python?

This is a simple example of a ...READ MORE

answered Oct 25, 2018 in Python by SDeb
• 13,300 points
5,688 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP