3 ms·
EDIT: nope, nope, this is all wrong. My mistake. Ignore everything else here. > classes don't need (object) anymore My friend, old-style classes became unnece
by DonaldPShimoda 7y ago
EDIT: nope, nope, this is all wrong. My mistake. Ignore everything else here.
> classes don't need (object) anymore
My friend, old-style classes became unnecessary with the release of Python 2.2 — almost 20 years ago now [0]. I'm afraid you've been living in the past. :)
[0] https://wiki.python.org/moin/NewClassVsClassicClass https://wiki.python.org/moin/NewClassVsClassicClass
- Myrmornis 7y agoNope, she/he has not. (object) were the new style classes!
- DonaldPShimoda 7y agoOh man, major brain fart there. You're completely right of course. I was thinking of the transition to classes-as-types in general. Probably would've helped if I actually read the page I linked...
- nerdwaller 7y agoExtending `object` was necessary until 2.7 when it became the default and old style classes were removed entirely in 3. So I think while the GP comment recently learned they don’t need to extend `object` anymore, they are/were familiar with new style vs old style classes.
- DonaldPShimoda 7y agoRight! Yes, another commenter pointed that out to me too. I made a goof and misremembered some things haha. Oops.
- auscompgeek 7y agoNew-style classes never became the default in Python 2: Python 2.7.15 (default, Jun 27 2018, 13:05:28) [GCC 8.1.1 20180531] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class Foo: ... pass ... >>> Foo <class __main__.Foo at 0x6218e384ee88> >>> class Bar(object): ... pass ... >>> Bar <class '__main__.Bar'> >>> isinstance(Bar, type) True >>> isinstance(Foo, type) False
- nerdwaller 7y agoThank you for the correction! I’ve not used Py2 in 6 or so years.