13 ms·
Guido on Python
- shadowmint 11y agoWhy take someones word for it? Watch the video and you can see what he actually said yourself; https://youtu.be/yCg3EMf9EYI?t=8m36s https://youtu.be/yCg3EMf9EYI?t=8m36s
- acqq 11y agoIt takes much less time to read an article. AFAIK LWN does a great job. Still, thanks.
- deleted 11y ago[deleted]
- RansomTime 11y agoI much prefer written content to videos. I can read them on my phone on my walk to work, whilst listening to music, for example.
- odonnellryan 11y agoI know others are saying they liked the article better, but I enjoyed the link. Thank you!
- Animats 11y agoFrom the article: Von Rossum is still running Python 2.7 in production at his day job at Dropbox.
- shadowmint 11y agoHis commentary starts at 12.38 in the video; it's really very thoughtful. Here are some choice quotes: ...and why should you switch? and ultimately, I'm not saying that you should switch. I would like you to switch... but I also recognize that it's difficult to switch, and it feels like a lot of hard work that you could also spend instead on say, improving the design of your website, or adding features to your application. but... So... python 3 is just a better language and it is getting better over time. Python 2 on the other hand, is a fine language, and it will remain exactly what it is. Yeah, we'll fix the occasional bug, but its asymptotically approaching 2.7 perfect, and its never going anywhere beyond there. So, that's why you should switch to python 3, because the only way to benefit from the good work the core contributors do, is by switching. Seems reasonable to me. Don't yell at people for using python 2; they have jobs and real like commitments to do things like running a company that pays people. ...but if you can use python 3, you should because it's only ever going to get better, while python 2 won't. (and my apologies if I've transcribed that incorrectly, I did my best to capture exactly what he said)
- mewwts 11y agoThis is the way we should think about it, imho. If you don't like Python 3, or have any other reason to stay at Python 2, do so! But don't be mad at people having a good time over at Python 3. I try to make my projects work with both, although that is getting increasingly hard.
- aidos 11y agoI haven't listened to it but I assume that should say "2.7 perfect", not "3.7 perfect". Thanks for taking the time to transcribe it.
- shadowmint 11y agosorry yes. (fixed)
- pekk 11y agoWhy did you edit in the implication that Python 3 is not applicable for people who have jobs and real life commitments to do things like running a company that pays people? That is your opinion, not Guido's. Python 3 is already being used in companies and it's plenty good enough for that. Including library support. Dropbox using 2.7 is no different from Dropbox avoiding PyPy, they are evidently ultra-conservative (and probably have a lot of old code they don't want to port).
- koenigdavidmj 11y agoA rewrite (even a small one like moving from Python 2 to 3) costs dev and test time, and makes it difficult to do any other work simultaneously. It's not going to happen unless it has some value (perhaps, for example, they wanted to use the new builtin async syntax of Python 3.5 instead of rolling their own).
- shadowmint 11y agoThat is my opinion, my Guido's. That's why it's not... In Quotes I'm not saying python 3 isn't suitable for production. I'm saying (and this is my opinion): If you have to use python 2, then do. If you can use python 3, then do. THIS is Guido's opinion: I would like you to switch... but I also recognize that it's difficult to switch, and it feels like a lot of hard work that you could also spend instead on say, improving the design of your website, or adding features to your application. ...at least, I have to assume so, because that's what he actually said at the keynote. So, take what you want from that, but don't accuse me of 'editing in' some implication. If you're happy using python 3; then be happy. ...but, if you shout at someone for using python 2, I think you're a douche, because there are real life reasons some people keep using python 2. ...and I. And..., clearly, Guido, acknowledge that. You don't have to. You can have your own opinion all you like... I honestly couldn't care less.
- mattbillenstein 11y agoI think this is good insofar as he gets to see the pain first hand that a lot of companies with large 2.x codebases are having with the idea of upgrading to 3.x.
- atmosx 11y agoI never understood what kind of changes Guido made from 2.7 to 3.0 that kept everyone off.
- lqdc13 11y agoThe backwards incompatible kind.
- stdbrouw 11y agoHardly any changes at all, and the things that did change didn't actually make a clear difference in productivity or the clarity of your code. The ability to make breaking changes wasn't really used to improve the language, maybe except for unicode handling – no new syntax (would've loved functions-as-blocks myself), no getting rid of old crufty syntax, nada.
- toyg 11y ago> things that did change didn't actually make a clear difference in [...] the clarity of your code print "%s remember to %s in %s if %s but never %s" % (some_random_tuple) vs print("{when} remember {what} in {room} if {condition} but never {dont}".format(* * dict_with_explicit_keys)) A bit verbose but much clearer and future-proof.
- icebraining 11y agoBut you can already do that in Python 2.7.
- mmarx 11y agoThat's an unfair comparison, however, print "%(when)s remember to %(what)s in %(room)s but never %(dont)s" % dict_with_explicit_keys was supported back in at least 2.4.
- Ded7xSEoPKYNsDd 11y agoPython 2.7 supports string.format and Python 3 supports % formatting. The only actual difference in that example is that print became a function in Python 3, requiring some additional parentheses. (Something that can be mechanically translated without much hassle.)
- wangii 11y agopython needs her alan cox!
- napsterbr 11y agoI've been using Python 3.4 (and now 3.5) for development and couldn't been any happier. The async features, specifically, are amazing. When starting a new project from scratch, I see no reason NOT to use python 3. Maybe if a few libs you depend heavily on are still not ported. Even in that case, though, it might be a good idea to start on Python 3. First because most libraries are already ported[1], and second, you could try porting that specific lib, or maybe running it as a separate service using python 2. I guess the problem remains about maintaining big, Python 2-based programs. [1] - https://python3wos.appspot.com/ https://python3wos.appspot.com/
- zephyrfalcon 11y ago"""When starting a new project from scratch, I see no reason NOT to use python 3. Maybe if a few libs you depend heavily on are still not ported.""" wxPython comes to mind... :-/ Also PyGame, although it seems that there are now development releases for 3.x.
- dom96 11y agoI would really love to ask Guido what he thinks of the Nim programming language.
- icebraining 11y agoWell, he's on Twitter and G+.
- JustSomeNobody 11y agoHe thinks it's an amazing language and you should switch to using it. He thinks this whole python thing has run it's course. /s
- fermigier 11y agoTwo quick notes, probably well-known in the Python community, maybe less so outside: 1. The biggest hurdle to overcome when moving existing code bases to Python 3 (affectionally known as py3k) is third-party libraries. This is the main reason why there is some pressure on library authors to move their libraries to Python 3. Cf. https://python3wos.appspot.com/ https://python3wos.appspot.com/ for some (very encouraging, IMHO) results. 2. It's possible, in many cases, and without two much effort, to write (or refactor) code that is compatible with both Python 2 and Python 3. One great tool for this is the python-future project: http://python-future.org/ http://python-future.org/ Cf. in particular: http://python-future.org/compatible_idioms.html http://python-future.org/compatible_idioms.html In some cases, it's even simpler. Flask, for instance, achieves it with a small 55 LOC module: https://github.com/mitsuhiko/flask/blob/master/flask/_compat.py https://github.com/mitsuhiko/flask/blob/master/flask/_compat... One last great resource is Lennart Regebro's book: http://python3porting.com/ http://python3porting.com/
- spinningarrow 11y ago"If you were to design a new language today, he said, you would make it without mutable (changeable) objects, or with limited mutability."
- estava 11y agoIndeed. That may mean fewer opportunities for "meta-programming" if by meta-programming we mean mutation of core structures. It could also be a good chance to turn around the default of declaring variables to declaring constants instead. Complex data structures would still have to be mutable by default I guess, but they would be the obvious next target to becoming immutable by default.
- eru 11y agoWhy would your complex data structures be mutable? Wouldn't immutability pay off especially in complex cases?
- cillian64 11y agoIf you make my huge NumPy arrays immutable, I will be very unhappy (unless I am significantly misunderstanding how this everything-is-immutable strategy works). There might be a lot to be said for rust-style immutable-by-default.
- juliangregorian 11y agoI assume using some form of copy-on-write.
- eru 11y agoFirst, you'd still have optional mutability. Second, arrays are rather simple data structures, but ones where you often care about performance--small tight loops are common. Compare that to the data structure that eg holding your options and flags for the computation: you don't do much computation on that, but you have lots of invariants that you want to uphold---ie lots of code, but each bit executed roughly once, no tight loops.
- estava 11y agoFeels like people will be urged to move to Python 3 due to the new features... And yet I'm thinking that Python 4 will happen before many have been able to move to Python 3. :-P
- toyg 11y agoBecause Python 4 will be only "whatever comes after the last 3.x", with no backwards-incompatible changes, it won't matter: porting to "python 4" will require the same effort as porting to 3. So start now ;)
- keithpeter 11y ago"Dropbox has a lot of third-party dependencies, some of which cannot even be rebuilt from the sources that it has. That is generally true of any company that has millions of lines of Python in production; he also saw it at Google. That also makes switching hard." Why can't these dependencies be built from the source they have presumably the same version as the currently build binary? Is it because other components of the build chain have changed or what? As a civilian, I found this situation mildly disturbing.
- jessaustin 11y agoPerhaps there are licensing issues?
- jofer 11y agoAt least in my experience, it's very common for vendors to provide you with the source (through a licensed agreement) but deliberately limit your ability to build it. Sometimes this is through licensing, sometimes it's by excluding some key portions of the build chain (e.g. internal libraries that don't directly relate the the functionality of the software). At any rate, at my current employer, we have lots of things where we have the source as well as the libraries and headers, but don't have the capability to build those libraries from source. It sounds silly, but it's still vastly better than having no source access whatsoever. At least for us, we often need to understand an implementation detail of a proprietary library, but being able to actually build things is secondary.
- keithpeter 11y agoGood heavens - 'ransom strips'[1] in software. I had no idea. Best of luck with it all... [1] http://www.rics.org/uk/knowledge/glossary/ransom-strips/ http://www.rics.org/uk/knowledge/glossary/ransom-strips/
- stared 11y ago> Python 3 is a "much better language" than Python 2, for one thing. It is much easier to teach. [citation needed] I find it much easier to teach language, where range(5) _is_ a list [0,1,2,3,4] rather than an iterator. Same thing for .keys() and .items(). For people learning their first language iterators are not simple. That said, right now I am teaching Python 3 rather than Python 2 (mostly due to unicode and division). Though, I have mixed filling towards Py2/Py3 transition (it's not all web dev, where all serious projects are getting ported; some projects are written only once and therefore changing to Py3 means letting them die).
- agentultra 11y agoI find it much easier to teach language, where range(5) _is_ a list [0,1,2,3,4] I thought so too at first but I think it was because I dislike change. When I really began to use Python 3 in earnest I came to like the idea because I've almost never taken the value of range. And teaching loops without intermediate variables is much easier. For example I would never teach this in Python: for i in range(10): print mylist[i] I would always teach this: for i in mylist: print(i) Which is clearer and easier to read? Did I have to teach you the Iterator protocol in order to understand that? No. It almost never comes up until you're an advanced Python user. In the rare case where I do need to take the value of range it becomes much more explicit: nums = list(range(10)) If you're an old-time Python 2 user you might ask why you have to pass range to the list constructor when it returns a list itself. But if you're a new Python programmer learning Python 3 you don't have those expectations: range is something you loop over and list is happy to do that for you. You could also write it out long-hand: nums = [i for i in range(10)] Which could be nicer if you wanted to transform the numbers or add some conditional filters. Over all I find Python 3 to be much more consistent in its design than Python 2 and thus easier to teach.
- stared 11y agoThe problem is that: - object castings are not nice (for code brevity/clarity - things, which Python aims to bee good at), - if objects are similar, it's pain to explain the difference (it's not a thought - it's a thing I had to deal with many times). In particular, if one is advanced programmer in general, or at least has a firm grasp of Python basics, iterators are nice. But for newbies, they are harder. (And it's even harder to hand-wave that they are "somethings, which can be casted into lists".) As a side note I dislike possibility of using tuples as iterables. It breaks "There should be one-- and preferably only one --obvious way to do it." i.e. using tuples in place where one (conceptually) should use a list. And again, explaining difference to newbies is painful ("tuple is a handicapped list").
- RyanMcGreal 11y ago> There are also bugs that are feature proposals that do have patches attached, but there is a general hesitation to accept changes like that because there is concern that they aren't useful, won't mesh with other similar language features, or that they will cause backward incompatibilities. It is hard to take patches without breaking things all the time. Obligatory: https://xkcd.com/1172/ https://xkcd.com/1172/
- arturhoo 11y agoI agree with Guido that the thing I hate the most in Python is packaging in general. I find Ruby's gems, bundler and Gemfile.lock to be a much more elegant solution. On the other hand, I really like the explicit imports (when used properly). Less magic that makes code navigation way easier.
- davexunit 11y agoAs a distro packager, I find Python's packages to be much better and easier to integrate than Ruby gems. I've had no shortage of troubles with Ruby gems: requiring on the git binary to build the gem (even in a release tarball), test suites not being included in the gem releases on rubygems.org, rampant circular dependencies, etc. Python's PyPI has caused me no such issues.