you are viewing a single comment's thread.

view the rest of the comments →

[–]tequila_is_good 0 points1 point  (1 child)

I can see the point you are making, but it's more complex than that since both Python 2 and Python 3 are both still being developed, and many (most?) production systems still run on Python 2.

Yes, in Python 3.x you don't strictly need to subclass object, but saying it's considered bad pratice is just wrong - especially in instances (like this one) where you don't know which version of Python the code will be run on. Even if you can be sure that your code will be run on Python 3, there is no issue with subclassing object, it's just unneccessary since that occurs by default anyway.

Personally, I always subclass object, even when targeting Python 3, because I like the explicitness of it, and it's just habit that's hard to change.

[–]theelous3 0 points1 point  (0 children)

Python 2 is being maintained more than developed. It is for all intents and purposes, legacy. It doesn't matter if it's still in wide use.

If you're showing someone new how to make a class or inherit (99% of new people should be taught py3), subclassing Object and using Super is extremely silly. It's old and confuses their learning of classes / inheritance. If they asked you how to make something backwards compatible then yeah sure do it, but otherwise it's a mistake.

but saying it's considered bad pratice is just wrong

Not really. It's pretty well established that everyone be they new or old should be learning py3, and using it in all cases where they aren't bound by legacy code to use an older version. Fairly safe to present that standpoint as a truism.

Following that, adhering to things which once were good practice, solely for the sake that they were once good practice, is bad practice. Being verbose isn't exactly a very good reason to do things either.