4 ms·
Ridiculous. Python 2 has many many warts and the right thing to do was to fix them. Why the heck is print a statement? Why do we have urllib and urllib2? Why ar
by orf 12y ago
Ridiculous. Python 2 has many many warts and the right thing to do was to fix them. Why the heck is print a statement? Why do we have urllib and urllib2? Why are generators not that useful?
>> That is a bad idea. Promises and futures are not a very good concurrency construct. Light threads, processes and message passing are better.
Not so much in Python I'm afraid. The new asyncio module is worth the switch by itself I find, while Twisted is pretty good it can be very verbose and suffers from a number of issues.
You say that it's not worth breaking backwards compatibility for genuine warts in the language and seem to think it's only worth progressing the language if its by implementing huge changes like adding a JIT or removing the GIL (why you would think of bundling requests or flask with Python is beyond me). Python 3 may not have those big blockbuster features but its a nicer language with fewer warts (from __future__ import division? please).
I gave Python 3.4 a try while porting a Twisted application to asyncio and I was very surprised. After using it in a couple of Django projects I have yet to come across any packaging issues, and I use the awesome 'six' library so my code runs on 2 and 3 without modification.
- jd007 12y agowhats a good and performant mysql library for python 3 to use? or did you use postgres for all those projects?
- Earwig 12y agoHow about oursql (https://pythonhosted.org/oursql/ https://pythonhosted.org/oursql/)?
- orf 12y agoI used postgres for all the projects I'm afraid, but the Mysql team provide a db-api compatible library here: http://dev.mysql.com/downloads/connector/python/ http://dev.mysql.com/downloads/connector/python/ that supports Python 3
- rdtsc 12y ago> Why the heck is print a statement? Why do we have urllib and urllib2? Why are generators not that useful? So what if it is. Why not just make prnt a function. Or println or something. Have urllib and urllib2. Make urllib2 or just put requests in the stdlib. Still don't see what was worth breaking backward compatibility over. > You say that it's not worth breaking backwards compatibility for genuine warts in the language and seem I say it is not worth doing it at the time they did. It just came too late. People how didn't pick python over other frameworks probably weren't put off by the print statement. This should have happened 5-10 years ago not now. Not it was time for better performance, packaging, web frameworks, better concurrency constructs. > ts by implementing huge changes like adding a JIT or removing the GIL (why you would think of bundling requests or flask with Python is beyond me). Removing the GIL shouldn't break sane code. With GIL you still have race conditions and have to guard against them. You just can't run CPU bound code in parallel. That would be nice to fix. And if it is beyond you read up on how JPython works because it doesn't have a GIL. > why you would think of bundling requests or flask with Python is beyond me) How does bundling a library like that break code? > I gave Python 3.4 a try while porting a Twisted application to asyncio and I was very surprised. I switched to using gevent from Twisted and saw speed improvement and code reduction by about 30-50%.
- orf 12y ago> So what if it is. Why not just make prnt a function. Or println or something. Make another function to print output while also having a print statement? "There should be one-- and preferably only one --obvious way to do it". Same with urllib. Lets just be clear, they didn't release Python 3 because urllib and urllib2 were not combined, so no by itself it's not worth breaking backwards compatibility for (and hence why there were 2 urllib modules). But combined with a bunch of other issues, some of which necessitate breaking backwards compatibility, why not combine them? > I say it is not worth doing it at the time they did. It just came too late. People how didn't pick python over other frameworks probably weren't put off by the print statement. Fair enough, but better late than never right? You can't maintain backwards compatibility forever especially with syntax changes. That's why it was put into a major release and the 2.x branch continued to develop. Porting the code isn't hard (there are even automated tools to do it, like gos gofmt command), and I think every major web framework supports py3 now. > How does bundling a library like that break code? The best things about python packages is they can be updated independently of the standard library that ships with Python. Why would you want to add flask or requests to the standard library? Is executing one shell command too hard? Including popular packages just because they are popular at the time is not a good thing to do. > And if it is beyond you read up on how JPython works because it doesn't have a GIL. You mean Jython? That's a silly comparison. CPython is the reference implementation for Python. A JIT compiler could be added to it, sure, but actually think about it for a second: writing a JIT compiler for Python is a huge undertaking. PyPy has one, but it's not 100% compatible (no eval and others for example, which is sometimes used) and for some workloads slows down execution. Not to mention PyPy is a very advanced project and it has taken years and years of development by people specialized in writing JIT compilers (remember Psyco for Python 2.5?) to get PyPy to where it is now, expecting the Python developers to whip up a usable JIT compiler in a jiffy is not exactly realistic. Adding one would add huge complexity to the reference implementation of Python, the same goes for the GIL. Read here[1] for reasons why the GIL will never be removed and use the awesomely simple multiprocessing library to spread work over multiple cores, that's why it was made. 1. https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock