- 3

python3 super fuction arguments

hi i discover that the super funciton takes some optional argument but can someone explain to me what super function does if the areguments are exist ?

16th Apr 2021, 12:56 AM
Imrane Aabbou
Imrane Aabbou - avatar
15 Answers
+ 1
Or you can go to the genuine doco; always worth checking. It is possible for a class to inherit from multiple classes, and the optional arguments let you choose between them. https://docs.python.org/3/library/functions.html?highlight=super#super
16th Apr 2021, 4:16 AM
Myk Dowling
Myk Dowling - avatar
+ 4
0MR4N , it doesn't always need to be self. If you are wanting to call a method from a parent class of one of your class' objects, you would specify that object instead of self. Another possibility is that you are importing a class from a library, and it has a private parent class that you don't want to import. If you wanted to access a class or static method from that private parent, you would put the class you have imported in that second argument, fitting the "or type" definition for the argument.
16th Apr 2021, 10:31 PM
Myk Dowling
Myk Dowling - avatar
+ 2
Here's a pretty good explanation of super() https://realpython.com/python-super/
16th Apr 2021, 2:44 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
0MR4N If you had thoroughly read the link I provided you'd have already known the answer. 😉
16th Apr 2021, 11:05 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
help me def balanced(expression): #your code goes here print(balanced(input())) Balanced Parentheses Parentheses are balanced, if all opening parentheses have their corresponding closing parentheses. Given an expression as input, we need to find out whether the parentheses are balanced or not. For example, "(x+y)*(z-2*(6))" is balanced, while "7-(3(2*9))4) (1" is not balanced. The problem can be solved using a stack. Push each opening parenthesis to the stack and pop the last inserted opening parenthesis whenever a closing parenthesis is encountered. If the closing bracket does not correspond to the opening bracket, then stop and say that the brackets are not balanced. Also, after checking all the parentheses, we need to check the stack to be empty -- if it's not empty, then the parentheses are not balanced. Implement the balanced() function to return True if the parentheses in the given expression are balanced, and False if not. Sample Input: (a( ) eee) ) Sample Output: False
4th Jun 2021, 10:46 AM
Ab. Ricky Handika
Ab. Ricky Handika - avatar
+ 1
ChaoticDawg yaaah i did 😆 but u knoooow i am hardhead
17th Apr 2021, 4:28 AM
Imrane Aabbou
Imrane Aabbou - avatar
0
Myk Dowling but sorry i knw now wht it does but what meas the second argumenet exactly and why it always need to be "self".
16th Apr 2021, 8:26 PM
Imrane Aabbou
Imrane Aabbou - avatar
0
Myk Dowling ok thank u so much i understand now
16th Apr 2021, 10:49 PM
Imrane Aabbou
Imrane Aabbou - avatar
0
why 10.1*6 = 60.599999999999994 10.1*3 = 30.299999999999997
4th May 2021, 7:58 AM
Satimboyev Diyorbek
Satimboyev Diyorbek - avatar
0
Mostrar preguntas print ("chupones")
5th Jun 2021, 10:21 PM
Stiven Rodriguez
0
Opino que el mejor es python 3
25th Dec 2021, 7:58 PM
Samuel Gomez
Samuel Gomez - avatar
0
Aún me cuesta crear code, ahí que dedicar mucho tiempo
25th Dec 2021, 7:59 PM
Samuel Gomez
Samuel Gomez - avatar
0
Alimontriks
25th Mar 2022, 9:14 PM
Abdelazize Abdo
Abdelazize Abdo - avatar
0
Make an algorithm that reads several numbers and tells you how many of those numbers between 100 and 200 were entered. When the value 0 (zero) is read, the algorithm must cease its execution. (someone answer
21st Apr 2022, 3:17 PM
Luis Gonzaga 神
Luis Gonzaga 神 - avatar
0
Hii
19th Nov 2022, 12:55 PM
Mahesh Jammy
Mahesh Jammy - avatar