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.

Transforming Code into Beautiful, Idiomatic Python [video]

54 pointsby s16halmost 11 years ago

2 comments

Monkeygetalmost 11 years ago
Slides: <a href="https://speakerdeck.com/pyconslides/transforming-code-into-beautiful-idiomatic-python-by-raymond-hettinger-1" rel="nofollow">https:&#x2F;&#x2F;speakerdeck.com&#x2F;pyconslides&#x2F;transforming-code-into-b...</a><p>Notes: <a href="https://gist.github.com/JeffPaine/6213790" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;JeffPaine&#x2F;6213790</a>
azeirahalmost 11 years ago
After a while, he shows the example of a find function<p><pre><code> def find(seq, target): for i, value in enumerate(seq): if value == target break else: return -1 return i </code></pre> Can&#x27;t you just remove the whole break and else thing and just do this?<p><pre><code> def find(seq, target): for i, value in enumerate(seq): if value == target: return i return -1</code></pre>
评论 #8011287 未加载
评论 #8011468 未加载
评论 #8011527 未加载