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.

Hidden features of Python

132 pointsby niyazpkover 13 years ago

3 comments

ubasuover 13 years ago
Older discussion:<p><a href="http://news.ycombinator.com/item?id=1512930" rel="nofollow">http://news.ycombinator.com/item?id=1512930</a>
phzbOxover 13 years ago
I already knew mostly everything in it (Time to switch to a new language!) but here's two that I didn't know:<p>1.<p><pre><code> from __future__ import braces </code></pre> Use {} to delimit scope!<p>2.<p><pre><code> try: import readline except ImportError: print "Unable to load readline module." else: import rlcompleter readline.parse_and_bind("tab: complete") </code></pre> Used to use [tab]-completion in terminal. One could correctly argue that using iPython would be smarter.. but sometime you are working remotely and don't want to get out of the terminal and install, etc.
评论 #3453257 未加载
评论 #3455168 未加载
zalewover 13 years ago
most of these features are so <i>hidden</i>, you learn them the first few nights with python