Live data from Hacker News

New features you can't use unless you are in Python 3

asmeurer.com

231–240 of 264 posts

Re: New features you can't use unless you are in Python 3

#231
post #148

Earlier quoted context omitted.

if performance is a problem, then start rewriting the critical pieces right now because python 2 also isn't for you. mypy is a much better type system than Java, btw, if that's what you're after.

> if performance is a problem, then start rewriting the critical pieces right now because python 2 also isn't for you. You say it as if that would be a strange position to be it, but it's a common situation. A lot of time you start with the faster to prototype / more familiar language, and outgrow it. That's what companies do after they grow so much that a language such as Python/Ruby/PHP is not doing it for them any…

all true and it's fine. python isn't be-all end-all, just like java isn't, go isn't, rust isn't, etc. it's a tool in a toolbox.

Re: New features you can't use unless you are in Python 3

#232
post #216
post #30

My personal favorite is native support for IP addresses, introduced in python 3.3[0]. Makes IP math and address validation so much easier. [0] https://docs.python.org/3/library/ipaddress.html

> address validation just try: socket.inet_aton

That doesn't seem to support IPv6 at all. And doesn't let you do much with a parsed address either.

Re: New features you can't use unless you are in Python 3

#234

Earlier quoted context omitted.

Python 3 has been available on most dists for 5-10 years.

What I said was the default version of Python is old on most distributions. For example, CentOS 6 ships with Python 2.6 out of the box. Even faster moving distros (like Ubuntu) are still trying to make Python 3 the default (although at least Ubuntu ships with both 2.7 and 3.4+ out of the box).

No one should be using CentOS 6 in 2017, if you think python is your problem and you're running CentOS 6 you need to take a good hard look at your platform.

Re: New features you can't use unless you are in Python 3

#235

Open page. Nothing works. Enable their scripts. First slide shows but nothing works - except the link to the pdf version. Why not give a link to the pdf version in a element?

I'll never understand those who break the internet on purpose and then complain that nothing works, and that the people actually spending money and doing work should cater to their niche tastes. Please stop. Thanks.

I'll never understand those who cannot serve a single page of static content without adding a bazillion of gratuitous hard dependencies on JavaScript libraries.

Maybe if more people resisted the temptation to use the latest and shiniest frameworks where it isn't warranted, I wouldn't have to upgrade my otherwise perfectly functional hardware every five years because it just can't handle all of today's most fashionable abstraction layers over plain HTML.

" rel="nofollow">http://motherfuckingwebsite.com/>

Re: New features you can't use unless you are in Python 3

#236

Earlier quoted context omitted.

That’s a giant can of worms. One example problem: Python 2 has a type of class (old-style) that doesn’t exist in Python 3. What happens when you try to pass this type of class or one of its instances between the languages? There’s a bunch of stuff like that. You’d end up with a very weighed-down interpreter with a bunch of caveats if you ended up with one at all.

Would doing that then deprecating those features after 5 years or so not be better than what's happened with the Python 3 transition? I'm curious what options there are for how to make such a transition smoother.

The important part of Python 3 is the bytes/str/unicode rework, and there’s no way to make that not a breaking change. Everything else is minor stuff that’s allowed to be breaking because the str change already broke backwards compatibility.

(And yes, making strings text rather than bytes was really that important. Python 3 would be a huge improvement even if it were only that and some other safety things like removing the default ordering of incompatible types.)

Re: New features you can't use unless you are in Python 3

#237
post #190

Earlier quoted context omitted.

As an independent contractor maintaining large Python 2 codebases, your comments really hit home for me. I only have a portion of my time each month to maintain and develop features for them. If the Python 2 floodgate ever breaks, I am more likely to rewrite the system in a statically typed language. Even today, I am tempted. I know that a sibling mentions the ridiculousness of the situation, but a forced depreciatio…

This. I don't think people realize that there are fixed costs that are born in making these kinds of migrations so that migrating to Java from python is not 100x more work than migrating from python 2 to python 3. There is no such thing as a small breaking change to a runtime. Maybe one way of thinking about it is to take a hard drive full of data and randomly flip a few bits. Then ask what the effort is to find and…

If you actually have tests it's not half as bad as you are making it out to be.

If your code base is a big pile with no tests.. well you dug that grave.

Re: New features you can't use unless you are in Python 3

#238
post #204
post #133

Earlier quoted context omitted.

Python 2 is a vastly more complex language compared to Python 3. Just try to name the basic classes of types that exist in Python 2. Hint: Cannot be counted on two hands.

Well, try this for me, especially that you didn't use searchable terminology, so it's hard to confirm what you're saying. And then tell how much of that is important for typical code.

Python 2 has old-style classes, new-style classes, functions, bound methods, unbound methods, slot wrappers, descriptors, method wrappers, built-ins, ... and I'm rather certain I forgot some. All kinda callable types I mentioned behave differently. This makes the language complicated; and due to the dynamic nature leads to subtle bugs that are only detectable at runtime. Python 2 is a lot like C there. This isn't limited to callables but is spread around the language in a lot of places. Python (both 2 and 3) is not a simple language. It has a supremely complicated data model whose documentation is insufficient and scattered.

Re: New features you can't use unless you are in Python 3

#239
post #190

Earlier quoted context omitted.

This. I don't think people realize that there are fixed costs that are born in making these kinds of migrations so that migrating to Java from python is not 100x more work than migrating from python 2 to python 3. There is no such thing as a small breaking change to a runtime. Maybe one way of thinking about it is to take a hard drive full of data and randomly flip a few bits. Then ask what the effort is to find and…

If you actually have tests it's not half as bad as you are making it out to be. If your code base is a big pile with no tests.. well you dug that grave.

Sure, we have tests, we have a whole ecosystem -- written in python2 -- but that's not a justification to introduce breaking changes or a guarantee that the tests will catch all regressions. We also have dependencies. Moreover, unless your system is a toy, tests aren't going to give you the same guarantees as having a system be hammered by real world events for 5 years.

Re: New features you can't use unless you are in Python 3

#240
post #198

How old is Python 3 now? I've always used Python for a "miscellaneous task" language, and still do... and even I find "...because you refuse to upgrade" a bit insulting. If I used it for something serious, even more so. The way 2.x -> 3.x was handled is/was/will is an absolute disaster. Upgrading simple scripts is a non-issue. Larger projects seem to always be a horrible pain.

I used to think like you, but when i started actually using Python 3 it all was a lot less worse than i've expected it to be from reading Hacker News comments. YMMV, but converting existing code for me usually didn't amount to more than adding parentheses around print statements. The proper support for unicode alone was enough of a reason to upgrade for me.

Exactly. I understand the attitude (about "refuse to upgrade") mainly because in hindsight I wished I'd have upgraded way sooner :)
Post reply on HN