4 ms·
This part is a little dated (it is a 2012 post after all): https://rszalski.github.io/magicmethods/#comparisons https://rszalski.github.io/magicmethods/#compari
by montecarl 8y ago
This part is a little dated (it is a 2012 post after all): https://rszalski.github.io/magicmethods/#comparisons https://rszalski.github.io/magicmethods/#comparisons
In Python 3 __cmp__ is ignored and you have to use the other methods. To make this easier, you can use https://docs.python.org/3/library/functools.html#functools.total_ordering https://docs.python.org/3/library/functools.html#functools.t...
- gvx 8y agoYeah. In Python 3, __div__ is gone, and only __floordiv__ and __truediv__ exist.
- opencl 8y agoIt's amazing that Python 3 was 4 years old when this post was made and yet saying "Python" was still implicitly assumed by basically everyone to mean 2.x.
- kjeetgill 8y agoIs it that amazing? I don't think I've had use 3 until this year and I still have to flip-flop. AND I say this as someone who was reading peps going into 3's release. Do Ubuntu or Fedora default to python 3 yet? Arch? My RHEL experience isn't as representative.
- bhrgunatha 8y agoArch's default is Python 3, but there are still many official Python 2 packages, mostly in community i.e. adopted from the AUR: Core: 1 Extra: 96 Community: 822 AUR: Over 2300 depending on how you search
- lathiat 8y agoThe official python recommendation is not to "default" the 'python' command as python3, and they should just explicitly be 'python' and 'python3' This is what every distro except arch does (for whatever reason) https://www.python.org/dev/peps/pep-0394/ https://www.python.org/dev/peps/pep-0394/
- mkesper 8y agoBut that should turn around NOW, comsidering 2020 will be EOL for Python2 (except for Redhat which will have to ride that dead horse for years to come).
- cferr 8y agoRHEL 8 will ship with Python 3 as the default. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.5_release_notes/chap-red_hat_enterprise_linux-7.5_release_notes-deprecated_functionality https://access.redhat.com/documentation/en-us/red_hat_enterp...
- sethgecko 8y agoUbuntu 18.04 ships with Python 3.6 and no python2
- opencl 8y agoWhat I was saying is that it's amazing Python 3 failed to gain any significant traction in 4 years. I personally have been using Python 3 since ~2010 but am apparently in a tiny minority on that.