3 ms·
Hidden features of Python
- ubasu 15y agoOlder discussion: http://news.ycombinator.com/item?id=1512930 http://news.ycombinator.com/item?id=1512930
- phzbOx 15y agoI already knew mostly everything in it (Time to switch to a new language!) but here's two that I didn't know: 1. from __future__ import braces Use {} to delimit scope! 2. try: import readline except ImportError: print "Unable to load readline module." else: import rlcompleter readline.parse_and_bind("tab: complete") 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.
- dshah 15y agoOnce you know a language that well, why is time to switch to a new language? Why not leverage that expertise and use it to write (more) great software?
- lloeki 15y agoOne does not preclude the other. You can both continue leveraging your experience in the mastered language when developing serious stuff and experiment aside with another language to discover new approaches and patterns to solving problems, which you can often reinvest in the mastered language.
- ryanbraganza 15y agoMake sure you actually try running "from __future__ import braces"
- ohgodthecat 15y ago>>> from __future__ import braces File "<stdin>", line 1 SyntaxError: not a chance
- zalew 15y agomost of these features are so hidden, you learn them the first few nights with python