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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The Python IAQ: Infrequently Answered Questions

83 点作者 albertcardona超过 14 年前

8 条评论

KirinDave超过 14 年前
I dunno why people think functional programming jobs are vanishingly scarce. They are not. If you can demonstrate skill in functional languages, you might even get recruited.<p>It's true there are more wage-slave code-a-day jobs, but those jobs can be easily filled by uninspired hacks who are in it for the money. If you're reading this, the odds of you being one of those hacks is very low. The job market is smaller, but the workforce of talented functional programmers is <i>much</i> smaller, so the demand is still high.<p>And Clojure &#38; Scala are even easier because you can get a java job and them worm them in. It's not difficult to make a compelling argument that Clojure &#38; Scala are better at Java than Java is.
评论 #1898203 未加载
pilom超过 14 年前
Great article, bad title. Someone with more kharma mind changing it to Python Infrequently answered Questions?
评论 #1897494 未加载
评论 #1897569 未加载
评论 #1898817 未加载
ximeng超过 14 年前
Python infrequently asked questions, google cache at<p><a href="http://webcache.googleusercontent.com/search?q=cache:norvig.com/python-iaq.html+http://norvig.com/python-iaq.html" rel="nofollow">http://webcache.googleusercontent.com/search?q=cache:norvig....</a><p>Seems a bit out-of-date (upcoming Python 2.5?), not sure why it's here really.
danio超过 14 年前
Is there much benefit to<p><pre><code> fact = lambda n: _if (n &#60;= 1) (1) (lambda: n * fact(n-1)) </code></pre> over<p><pre><code> def fact(n): if (n &#60;= 1): return 1 else: return n * fact(n-1) </code></pre> 1 line vs 5 lines doesn't seem like an advantage to me when it takes pretty much the same amount of time to read and understand the complicated 1 liner.<p>Is there more optimisation possible?
评论 #1898018 未加载
评论 #1897681 未加载
评论 #1898215 未加载
评论 #1898589 未加载
anateus超过 14 年前
Some of the responses are outdated, here's one of the things that is now part of python:<p>Python 2.5 introduced <i>defaultdict</i> in the <i>collections</i> module:<p><pre><code> from collections import defaultdict d = defaultdict(int) d['foo'] +=1 # look ma! no error! </code></pre> For this application, if you're using Python 2.7 there's now a <i>Counter</i> in <i>collections</i>, you can do the same as above, just call Counter(). You can also do:<p><pre><code> c = Counter(iter) # iter is an iterable. It will count the elements!</code></pre>
noahlt超过 14 年前
It's also worth noting that, in Python 2.6 and higher, we DO have a ternary operator:<p><pre><code> x = 3 if foo() else 6</code></pre>
tomotomo超过 14 年前
If u cn rd ths... then you may speak Hebrew or Arabic, which are basically written without vowels.
albertcardona超过 14 年前
Regarding the "if thr wr any", and the rise of Haskell and Clojure, I wonder whether such caveat applies any longer.<p>As for content of the Python IAQ, I've enjoyed learning about two python idioms I had never known possible:<p>1. The ternary conditional operator:<p>x = &#60;result&#62; if &#60;test&#62; else &#60;alternative&#62;<p>2. Using <i>or</i> to assign an alternative value when the first is False or None<p>x = &#60;option&#62; or &#60;option&#62;
评论 #1897580 未加载
评论 #1897993 未加载
评论 #1897631 未加载
评论 #1900722 未加载
评论 #1898592 未加载