TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Facts and myths about Python names and values

68 点作者 stakent将近 12 年前

5 条评论

nslocum将近 12 年前
In the Wrapping Up section, there are some very interesting points that weren&#x27;t covered in the article.<p><pre><code> - Why is &quot;list += seq&quot; not the same as &quot;list = list + seq&quot;? - Why is &quot;is&quot; different than &quot;==&quot; and how come &quot;2 + 2 is 4&quot;, but &quot;1000 + 1 is not 1001&quot;? - What&#x27;s the deal with mutable default arguments to functions? - Why is it easy to make a list class attribute, but hard to make an int class attribute? </code></pre> I&#x27;d love to read an article on these topics. Anyone have links?
评论 #6042097 未加载
评论 #6041612 未加载
评论 #6041668 未加载
评论 #6041345 未加载
topherjaynes将近 12 年前
Ned always has fantastic articles, and the way this is lays out the mutable values name relationship, is it just lazy programming that has multiple names pointing to the same mutable value(s) or are their specific cases when that would make since to have list(a) list(b) point to the same value(s)?
评论 #6043603 未加载
TazeTSchnitzel将近 12 年前
JavaScript works identically.
B-Con将近 12 年前
Personally, THIS is what an &quot;intro to language X&quot; article should look like. It walks you through how the language thinks, which is one of the things you need to learn in order to understand how to best use it and why things are the way they are.
lubomir将近 12 年前
The vizualizations on pythontutor.com are really helpful in explaining those concepts.