Hacker News new | past | comments | ask | show | jobs | submit login

When can we start calling Python 2.7 legacy code?



Now.

seriously. I think we have to treat it as legacy code now.


2009.

Seriously, it’s been 10 years since Python 3 came out, Python 2.x has been supporting legacy code since then.


Python 3.3 was the first version >3 that was actually "good". Prior versions were, if not unusable, not a great experience. Even when writing new code. And some of the Python core devs (Raymond Hettinger) share that opinion.

And let's not understate what a big deal it was to break compatibility like that. Porting a sufficiently complex project is non-trivial.


Biggest failure of the Python group is definitely the 2.7 / 3.x nonsense. It annoys me greatly when I see new code on 2.7, thanks a lot Nordic.


This is the only way how Python2 should be treated.


EDIT: My comment is grossly misunderstood and I cannot delete my comment. I did not imply python 3 causes bad code, I was trying to tell a story about how "our" python 2 code is handsome and python 3 code is ugly; sorta implying python2 is not necessarily legacy code. I have absolutely no problem with python 3 and prefer it over python 2. I do not want to start a 2 vs 3 flamewar please just ignore this comment.

===

My company has >1 million line of python 2.7. About 1.5 year ago we managed to pass our test harness (about 80% line coverage) in python 3. At the moment we can't do that but we believe if we tried hard for a few weeks we can do it again too. I don't know how we define "legacy code" but I code in this codebase everyday and the code is actually very pretty and understandable. We also have a python 3 project (only a few thousand line of code) and god that code is definitely ugly as shit. Even after python2 goes unmaintained, I will still think our python3 code looks more like legacy.


Plenty of old code is beautiful. "Legacy" code is code that relies on technologies that are no longer supported. That's not to say I don't sympathize and I know that the transition is not trivial in a large codebase, but when it comes down to it yes, it's probably necessary to start thinking of Python 2 code as legacy.


If your Python 2 code is clean and your Python 3 is ugly, I don't know what the hell you are doing. They are almost the same language. Are you trolling?


Probably the Python 3 code was rushed and/or written by an inexperienced programmer. That would just be a coincidence, nothing to do with Python 2 or 3.


The narcissism of small differences: it makes us notice differences (and dislike the differences) between things that are mostly identical to outside observers.


> that [python3] code is definitely ugly as shit

Can you please give some examples? I've recently picked up Python 3, wondering what well known traps I should avoid.


No I did not mean python 3 is what makes the code ugly. I just said the code is ugly and it happened to be python 3. As an answer to your question, just stick to pythonic principles and you'll be good.


Python3 was cleaned up pretty well, however it's up to devs whether to use the latest cryptic features no one understands.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: