TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Python 2 vs. Python 3: A retrospective

114 pointsby mitchelllcover 11 years ago

16 comments

justinmkover 11 years ago
I&#x27;d really like to see the video for these slides. But here&#x27;s what caught my interest:<p><pre><code> Set and dict comprehensions {x**2 for x in range(10)} {x: x**2 for x in range(10)} Why reduce() must die: ... the applicability of reduce() is pretty much limited to associative operators, and in all other cases it&#x27;s better to write out the accumulation loop explicitly. int [divided by] int should return float nonlocal </code></pre> Explicit nonlocal variable modifier which (I guess) &quot;promotes&quot; the variable outside its local scope. Kind of the inverse of Java requiring &#x27;final&#x27; to bind a variable to a closure.
评论 #6704770 未加载
yeukhonover 11 years ago
The one thing I wish they could change in the future is forcing list and dictionary iterable same syntax:<p>instead of writing<p>for index, element in enumerate(some_list)<p>for key, value in my_dict.items()<p>they should unify and make items and enumerate default behavior. i.e.<p>for index, element in my_list:<p>for key, value in my_dict:<p>I really don&#x27;t see the benefit of not doing this as default behavior. I always find if I need to loop a list there is a good chance the index can help, and even if I don&#x27;t need it it doesn&#x27;t hurt to have one either. Simple is better. And the whole looping dict and get back the key only sucks too because you often need the value as well so you essentially do dict[&quot;key&quot;] but why not just default return both key and value?
评论 #6704538 未加载
评论 #6704675 未加载
评论 #6705506 未加载
评论 #6706685 未加载
评论 #6704684 未加载
MBlumeover 11 years ago
Can anyone else not read the last lines of some of the slides?
评论 #6704843 未加载
评论 #6704392 未加载
评论 #6704554 未加载
评论 #6704374 未加载
_random_over 11 years ago
&quot;People positively hate incompatible changes – especially bad for dynamic languages&quot;, &quot;Never again this way – the future is static analysis and annotations&quot;.<p>Wouldn&#x27;t it be better to pick a better-suited language then?<p>John Carmack put it nice way:<p>&quot;One of the lessons that we took away from Doom 3 was that script interpreters are bad, from a performance, debugging, development standpoint. It’s kind of that argument “oh but you want a free-form dynamically typed language here so you can do all of your quick, flexible stuff, and people that aren’t really programmers can do this stuff”, but you know one of the big lessons of a big project is you don’t want people that aren’t really programmers programming, you’ll suffer for it!&quot;
评论 #6707133 未加载
tompover 11 years ago
Why does Guido think that slices syntax is screwed up? I mean, it&#x27;s not exactly natural, but at least it&#x27;s consistent (first bound is included, second is excluded):<p><pre><code> a = &#x27;12345&#x27; a[0:-1] == &#x27;1234&#x27; a[-1:0:-1] == &#x27;5432&#x27; </code></pre> Personally, I think that &quot;downcounting&quot; slices are rarely used. For code clarity, I prefer reversing the string&#x2F;list first.
评论 #6704579 未加载
midgetjonesover 11 years ago
I would have been more interested in learning Python if there wasn&#x27;t such a great divide. I read the first chapter of several books that said &quot;Python 3 is out, but we&#x27;re going to stick with 2.7 because too much shit is broken&quot;.
评论 #6704734 未加载
评论 #6704762 未加载
评论 #6704744 未加载
michielvooover 11 years ago
Question for the professional Python developers: do you (on a daily&#x2F;weekly&#x2F;monthly) basis switch between projects in Python 2 and Python 3? Is that hard to do (e.g. do you have to constantly and consciously remind yourself of syntax&#x2F;semantic differences), or does your mind sort of automatically adjust to the new&#x2F;old patterns?
pmelendezover 11 years ago
This is my problem with Python: &quot;Rename func_name —&gt; __name__, etc Rename .next() —&gt; .__next__()&quot;<p>Too many ugly renames, too few alternatives of doing things. To be honest the only attractive thing to me is all the libraries that they support but I don&#x27;t find the language itself interesting.
评论 #6704704 未加载
评论 #6704761 未加载
评论 #6706193 未加载
评论 #6704685 未加载
izzle9over 11 years ago
whoa did he just say static analysis is the future?
评论 #6704557 未加载
评论 #6706151 未加载
fidzover 11 years ago
Could someone create&#x2F;convert the PDF version? I don&#x27;t think my computer good enough to open PPT* format<p>Edit: not really needed, just loaded the dropbox preview, it is still readable
mortenlarsenover 11 years ago
Angry noscript user here. Visit URL... almost blank page... with non-working download button. Enable Javascript... Get .pdf named .pptx.
评论 #6704597 未加载
rpedelaover 11 years ago
Does Python 3 fix the import system? Can I import a file from any location in the file system?
评论 #6713368 未加载
pstuartover 11 years ago
Now that I get to use Go, I have no desire to go back to python. I think I&#x27;m not alone, and that python will soon enough become the new perl.
评论 #6704670 未加载
评论 #6704697 未加载
评论 #6704486 未加载
评论 #6704424 未加载
U2EF1over 11 years ago
empty dict: {:} empty set: {}<p>Ah, the road not taken.
andylover 11 years ago
It seems like I&#x27;ve been reading about the difficulties of Python V2 -&gt; V3 for awhile. Why is that? Is this Python upgrade unusually difficult&#x2F;ambitious? Or is the Python community just very reluctant to jump on new things?
评论 #6704885 未加载
评论 #6704767 未加载
评论 #6708392 未加载
评论 #6704839 未加载
评论 #6704774 未加载
评论 #6705170 未加载
mixmastamykover 11 years ago
As a dev that hasn&#x27;t been able to move to Py3 yet (but will soon), I&#x27;m wishing they&#x27;d fix the rest of the issues, bundle PyPy, and ship Python 4 instead! Make it a compelling upgrade.<p>Then Py3 could be nicknamed &quot;Vista,&quot; I suppose.