python - Class definition parameter vs. Normal class definition -


this question has answer here:

what difference between two? don't both of these have same functionality? don't understand whole point of object parameter.

class car(object): # object parameter     def foobar():         print("hello world!\n")   

vs.

class car(): # no parameter     def foobar():         print("hello world!\n") 

in python 2, former "new-style class" , latter "old-style class" exists backwards compatibility. should never use latter new.

in python 3, believe there no difference @ all. can leave out parentheses entirely.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -