Live data from Hacker News

Making Python 3 more attractive

lwn.net

71–80 of 172 posts

Re: Making Python 3 more attractive

#71
post #53

Earlier quoted context omitted.

from __future__ import print_function on python2 solves the print function incompat.

Exactly this Why is changing 'print stuff' to 'print (stuff)' such a big deal? I think 2To3 solves a lot of print cases https://docs.python.org/2/library/2to3.html

To what end though? It's a small thing sure but it's busywork. Why am I being asked to do busywork?

Re: Making Python 3 more attractive

#72
post #23

Reasons I am excited about Python 3: * "yield from" * Unicode support (I'm German and the clear distinction between bytes and unicode really makes my life easier) * function annotations (PyCharm interprets them and uses them for static type checking) * cleaned up stdlib (not only names, but also features) * asyncio Library support is very good nowadays, pretty much all of the important libraries are either ported to…

So far I've focused on making new projects both Python 2 and 3 compatible, but "new stuff" in Python 3 is not always available when:

- Laptop running Ubuntu Trusty: Python 3.4

- Production servers with Debian Wheezy: Python 3.2

- Laptop running Fedora 20: 3.3.2

You don't usually install Python in Linux using upstream, you install the version provided by your distribution and unfortunately Python 3 has differences between these versions (eg, "yield from" was introduced in 3.3, IIRC), whilst 2.7.x it's been without changes for a long time.

Even Apple includes 2.7 now (handy when I distribute a game made with Pyglet); so I'm excited too, but Python 2 still makes my life easier.

Re: Making Python 3 more attractive

#73
post #26

> Windows has the CreateFiber() API that creates "fibers", which act like threads, but use "cooperative multitasking". For POSIX, using a combination of setjmp(), longjmp(), sigaltstack(), and some signal (e.g. SIGUSR2) will provide coroutine support though it is "pretty awful". While it is "horrible", it does actually work. I do this, and it works perfectly well. Here's a full implementation demonstrating this appro…

FYI, greenlet already includes stack switching code, so it would make more sense to use that.

https://github.com/python-greenlet/greenlet/tree/master/plat...

Re: Making Python 3 more attractive

#74
post #61

The article mentions stackless Python. My understanding is Guido didn't want to merge it because it would break backwards compatibility with extensions. That was a long time ago when Python's userbase was much smaller. I wonder if Python be in better shape today had they merged stackless back then.

I think Python is in great shape. On Unix it is the dominant scripting language.

https://www.google.com/trends/explore#q=Python%20programming...

Re: Making Python 3 more attractive

#75
post #47
post #5

Python developers would almost all upgrade in a single minute for 30%+ better performance. It's interesting that performance wasn't a topic at this rump session as reported; I moved over to Go about a year ago, and while I miss Python's expressivity at least once a week, I'm just not willing to slow down all my programs by 5x. On the other hand, if Python could double in speed, I'd likely try to rework it into our wo…

>Python developers would almost all upgrade in a single minute for 30%+ better performance. But strangely they don't - PyPy has hardly gained traction (albeit the python2->python3 switch didn't help) and looking at the benchmarks that's more like 5-7x performance. I suspect that most often, in places where performance matters enough in a way that would warranted refactoring a code-base from cpython to PyPy, they alre…

A lot of the problem is that PyPy isn't completely compatible with C extensions.

Re: Making Python 3 more attractive

#76
post #12

OK... so from a _practical_ perspective, can someone tell me why I should move to python 3? None of the arguments presented to switch are strong enough :-/

A practical perspective depends very much on your specific use case. Server programming? Scripting? Scientific computing? Games? Tooling?

Re: Making Python 3 more attractive

#78
post #16

Earlier quoted context omitted.

There are a lot of Windows users who are happy with XP too. I remember trying to explain to people 20 years ago why HDTV was better than what they had. Most people were happy with 480 lines of resolution, or thought they were. It's human nature. By being accommodating, you've made the problem harder. Apple is the only company that says screw legacy. Of course users complain but they just grumble and know to accept it…

But Swift is an actual example of something with no legacy to worry about. Instead of being Objective C++2015, it's an entirely new language. And, more importantly, Apple can give guidance that people have to follow. As Swift matures, regresses, and has the bugs worked out of it, and library support is fully developed, Apple can arbitrarily identify a point at which Objective C just has to die, and the developers (if…

Swift has legacy builtin. It is forced to use Objective-C's OO mechanisms.

Re: Making Python 3 more attractive

#79
post #77
post #31

Just make it faster and everybody will move. No need for fancy new stuff... I'm eager.

"Just make it faster and everybody will move" is demonstrably false. See PyPy.

Of course, "no regressions" is another condition. With PyPy lots of C extensions break.

Re: Making Python 3 more attractive

#80
post #38

It's not about a need for new features. It's about basic quality control. I recently ported a medium-sized production system (the back end of "sitetruth.com") from Python 2 to Python 3. It took about a month. Not because of the language changes, but because several major third-party packages were discontinued for Python 3, and their replacements were buggy. Specifically: - Python 3 forces you to use CPickle instead o…

Re: FCGI/WSGI with Apache, after a lot of frustrating trial & error I found https://code.google.com/p/modwsgi/ to work the best.

If you can dump Apache, uwsgi and nginx is (imho) a much nicer way to host python apps.

Post reply on HN