+ 1

whats wrong in this code

class myfunc(list): pass When I execute the above code on repl I get : Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: list() takes at most 1 argument (3 given)

22nd Apr 2017, 7:46 PM
Akshata
4 Réponses
+ 12
Try avoiding naming variables and method arguments with already meaningful names like restricted keywords or datatypes. list() is a built-in datatype, that confuses Python interpreter.
22nd Apr 2017, 7:56 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
Please link your code from the playground.
22nd Apr 2017, 7:49 PM
Manual
Manual - avatar
+ 2
the 2 lines you provided don't throw that error on my ide.. need to see the part of your code where you call this.
22nd Apr 2017, 7:50 PM
LordHill
LordHill - avatar
0
thank you everyone..!! I was confused as the 2 lines of code execute fine on an online browser repl (https://repl.it/languages/python3) but on python3.5 installed on my system - it errors out. So wanted to know why it errors out on my system.
22nd Apr 2017, 11:02 PM
Akshata