4 ms·
It may sound strange, but we're the other way around. With Python 3 being the only future of Python, the inability of something like Django to support Python 3
by SiVal 15y ago
It may sound strange, but we're the other way around. With Python 3 being the only future of Python, the inability of something like Django to support Python 3 is, for us, a hurdle to adopting Django, not Python 3.
- peteretep 15y agoThis has retarded any progress of mine toward learning Python. Every so often the urge strikes me, and then I remember that I want to learn Python 3, and then I remember that means no Django, and I tend to go and learn something more fun and less practical...
- lloeki 15y ago> learning Python By any means, if you feel the urge, you really should help yourself and scratch that itch. I understand that for someone new to python (hence lacking the knowledge to get what's different between 2 and 3) you might feel uneasy about it, but really you should not. Just learn py2.7 (+ django if that's you want) now, and bulletproof your code by using u"", b"", .encode and .decode at the edge when needed, also 123L in your code, together with from __future__ import division, print_function, and whatnot. The remainder is mostly syntax (like except) or namespace (like http.server) changes and will get caught and thus easy to fix when you try to run in py3 (contrary to if you don't use u""/b"" as values can "move" through code and blow up in a completely unrelated area). I might be forgetting something, but that's the gist of it. As for learning, really you will have zero trouble acclimating yourself to any breaking change py3 introduces. The trouble only lies in existing, 'legacy' code, not for the one you write from scratch straight in py2.7, and especially if you aim for compatibility with the provided forward-compatibility features of python.
- peteretep 15y agoThat's interesting and informative, thanks. The list you've given looks like a good start - is there a definitive list you'd recommend anywhere?
- lloeki 15y agoThere's the official "What's New in Python 3.x" release notes [0][1][2] and some IBM articles [3][4]. [0] http://docs.python.org/release/3.2.1/whatsnew/3.0.html http://docs.python.org/release/3.2.1/whatsnew/3.0.html [1] http://docs.python.org/release/3.2.1/whatsnew/3.1.html http://docs.python.org/release/3.2.1/whatsnew/3.1.html [2] http://docs.python.org/release/3.2.1/whatsnew/3.2.html http://docs.python.org/release/3.2.1/whatsnew/3.2.html [3] http://www.ibm.com/developerworks/linux/library/l-python3-1/ http://www.ibm.com/developerworks/linux/library/l-python3-1/ [4] http://www.ibm.com/developerworks/linux/library/l-python3-2/ http://www.ibm.com/developerworks/linux/library/l-python3-2/
- maaku 15y agoGreat post. A point I want to emphasize is that learning py2.7 is learning Python 3, if you are careful to pay attention to the recommended/pythonic way of doing things. For the most part Python 3 removes syntax and functionality that was long-since depreciated or at least strongly advised against.
- sirclueless 15y agoPerhaps, but the lack of bytestrings seems to be what bites everyone. It's the only "deep" change and it affects anyone who wants to slice raw bytes (which includes most web frameworks).
- koenigdavidmj 15y agoPython 3 has bytestrings. They look like this: b'foo' And you can slice them up as you wish.
- koenigdavidmj 15y agoPython 3 has bytestrings. They look like this: b'foo' And you can slice them up as you wish.
- EnderMB 15y agoIt may sound the same, but I had that same feeling towards Python. I eventually dipped my toe into Python 3, but my main desire was to use Django for a work project and naturally we ditched it for ASP.NET (a decision I don't regret as ASP.NET is a great framework).
- rmgraham 15y agoA couple years ago I decided to learn Python. I took a quick look, saw Python 3 was the "latest", and started working on my app, using http://docs.python.org/py3k/ http://docs.python.org/py3k/ as my guide. It wasn't until a month later when I went to deploy that I discovered Python 3 wasn't what everyone was using. It was a small app, so it only took me a a day to port it to 2.6. My point is go ahead and learn Python 3. The hurdles of back-porting are pretty minor when you don't have any version specific habits.
- maaku 15y agoUnfortunately all the hooplah about Python 2/3 porting has created an image, reflected in your posting, which is simply not true. To a large extent Python 3 is just a superset of the functionality of Python 2.x, adding such features as keyword-only arguments and exception chaining. This is typical for Python: each new release typically includes a handful of new community-vetted syntax features. What's unique about Python 3.0 is that this one, exceptional time they allowed themselves to go back and eliminate deprecated syntax and functionality, and to tweak a few aspects of the language (namely Unicode strings) in subtle, but fundamental ways. It's been a long, drawn-out process in part because everyone uses Unicode strings (and if you're not, you should be). Python 2.x let you be fairly lax about unicode vs. legacy/byte strings. Python 3 forces you to clean up your act and be explicit. Other than that the two languages are -basically- the same. This isn't like C vs. C++ (which share an unhealthy fetish for curly braces but are quite different under the surface), but rather more like K&R C vs ANSI C, or C++03 vs C++0x. In other words if you're waiting for Django/SQLAlchemy/whatever to transition, don't bother. Learn Python 2.7 today, use it, love it, and transition to Python 3 only when all your dependencies have made the switch. You'll then have to change a few minor things like "raise Exception, reason" to "raise Exception(reason)", but I'm sure you'll adapt just fine.