5 ms·
I just realized I didn't answer your actual question, sorry. > what is it that you like about Python 2? I came from C and Pascal so from that POV Python is a
by carapace 7y ago
I just realized I didn't answer your actual question, sorry.
> what is it that you like about Python 2?
I came from C and Pascal so from that POV Python is a rich and delicate syntactic and semantic gravy over the same basic functionality plus shell (Python was originally the shell language of the Amoeba distributed OS†).
Things that might not seem that big a deal these days were a revelation to me when I started with Python:
- The basic datatypes, list, tuple, and dict, are enough to describe so much of the tasks you need to do.
- Slice notation is so useful, and works on the left-hand side (you can assign to slices) and the elegance (you can reverse a string or list or tuple by oof = foo[::-1].)
- The simple but effective OOP model, "dunderscore" methods, monkey-patching is possible.
- How can I forget! Indentation for blocks! So crazy but it works so well.
- long ints that don't overflow! So nice.
I can go on but really it was the whole thing, the syntax, the semantics, the standard lib. But in my opinion it reach a zenith sometime between 2.4 and 2.7, and even then Python overgrew its ecological niche. (What I mean is that if your project has more than 100,000 lines of Python you're pretty much fucked, but people do that all the time these days. I once worked on a horrible old "lava-flow" enterprisey Python codebase that could have been replaced by Excel but instead employed a gang of programmers. Pure waste.)
†https://en.wikipedia.org/wiki/Amoeba_(operating_system) https://en.wikipedia.org/wiki/Amoeba_(operating_system)
- ARandomerDude 7y agoThanks for your thoughtful responses!
- carapace 7y agoCheers!
- depressedpanda 7y agoWhile I agree with most of your points, nothing you said really highlights why python2 is better than python3. (Also, you're definitely not fucked with more than 100k LOC of Python, if the devs know what they're doing. Unit/regression/integration tests, type hinting, and a modular design goes a very long way)
- carapace 7y ago> nothing you said really highlights why python2 is better than python3. I never said that. In fact, I admit that in some ways 3 is better than 2. However, that 2 is static (unchanging) while 3 is being actively changed means that, as time goes on, the cost of using 2 will decrease while the cost of using 3 will increase. > Also, you're definitely not fucked with more than 100k LOC of Python, if the devs know what they're doing. Unit/regression/integration tests, type hinting, and a modular design goes a very long way I was engaging in a bit of rhetorical flourish there. I know it can be done, but it's not Python's "sweet spot". For large projects, Java or Haskell or even Ada are preferable IMHO. And I say this as a Python partisan. Cheers!
- gnulinux 7y agoBut all of these are in python 3 too?
- carapace 7y agoYes, but... Because 3 is incompatible with 2 I evaluate the cost/benefit of using it compared against all other languages, not just 2. From that POV, I find that e.g. Julia, Haskell, or Prolog are much more compelling than Python 3. Python 3 doesn't add anything radically better than 2. (Most of the new language "features" to me seem like they should be libraries instead: fstrings, enums, dataclasses; I can't understand why people think asyncio is cool but ignore Twisted (which is a huge treasure chest of amazing capabilities!)) Since I see 3 as only marginally better than 2, the main difference between them is that 2 is stable and mature while 3 is in flux, and that consideration mashes the cost/benefit ratio waaaay over in favor of 2, IMO.
- gnulinux 7y agoPorting a python 2 project to Julia/Haskell/Prolog is rewriting the entire codebase. Porting py2 to py3 is a little more than a few men-month of work. In my company we have >2 million line of py2 code and we spent a few weeks converting all to py3 (biggest problems being str/unicode and None comparison) and less than a month later our prod runs py3. I don't want to come off condescending, I really want to understand your point. But I have no idea what you're trying to say. Sure, technically py2 and py3 are different languages. So what?
- carapace 7y ago> I don't want to come off condescending, I really want to understand your point. Same here! Well met. > But I have no idea what you're trying to say. Sorry, I'll try again. > Porting a python 2 project to Julia/Haskell/Prolog is rewriting the entire codebase. Sorry, I was thinking of new projects there. To understand my point keep in mind that I'm assuming a world where Python 2 stays stable and maintained (if only because I'm maintaining it) so the option of not converting to Python 3 is on the table. In that world, I don't see a compelling reason to adopt Python 3 when Python 2 still exists and is stable. (And FWIW I think some of the py3 folks realize this and that's why they are so eager to "cannibalize" the old for the new, precisely because py3 can't really compete on its own merit against its entrenched incumbent ancestor, eh?) > In my company we have >2 million line of py2 code and we spent a few weeks converting all to py3 (biggest problems being str/unicode and None comparison) and less than a month later our prod runs py3. You paid a modest but non-zero cost to convert and then what did you get? Was it faster? You didn't convert 2M loc py2 to, say, 1.8M loc py3? If Python 2 wasn't going away (my premise) would you have converted to Python 3? If so, why? PyPy is delivering speed improvements, and to me it seems like most if not all of the other language features of py3 can be done in py2 with libraries. Other than compatibility with py3, what was the payoff? > Sure, technically py2 and py3 are different languages. So what? Two things: first, the whole reason this mess is happening is IMO because py3 interpreter can't run py2 code. If it could I think the transition would have gone smoothly and been done by now. It wasn't necessarily a bad thing to correct some warts, but it was a deliberate choice to "kill" Python 2 despite the obvious fact that we're going to be stuck with it for years to come (COBOL! FORTRAN! Like Elder Gods, these things don't die.) Really, i don't mind py3! It's the effort to throw py2 onto the funeral pyre while it's still kicking ("I feel happy! I feel happy!") that I find objectionable. Second, and IMO this is the big deal: py2 is stable while py3 is in flux. If the language stops changing that means people can work on the tooling and implementation instead. If I was managing a codebase the size of yours I would be much more interested in PySonar (or Cython or Nuitka) than anything that py3 brings to the table. Changes in the language require changes in the tooling (even just your syntax highlighters) so IMO they should be really good to pay for the expense of learning them and supporting them. For example, algebraic data-structures with pattern matching would be a nice addition to Python. (But then, you can do that in a library too!) In sum, the very fact that py2 is now stable and unchanging is a killer feature (IMO) that differentiates it from py3!