Live data from Hacker News

Hidden features of Python - Stack Overflow

stackoverflow.com

11–17 of 17 posts

Re: Hidden features of Python - Stack Overflow

#11
post #9

Earlier quoted context omitted.

XKCD is never obligatory. Seriously, why is anyone "obligated" to post a comic that mentions Python, but adds nothing of substance, and isn't even funny? ( http://www.google.com/search?q=site%3Anews.ycombinator.com+%... )

Well, "import antigravity" is sure enough a hidden feature of python. Well hidden. So hidden that I couldn't find it in any version of the interpreter :)

Actually it is included in Python 3:

http://svn.python.org/view/python/trunk/Lib/antigravity.py?v...

Re: Hidden features of Python - Stack Overflow

#12
post #7

Earlier quoted context omitted.

XKCD is never obligatory. Seriously, why is anyone "obligated" to post a comic that mentions Python, but adds nothing of substance, and isn't even funny? ( http://www.google.com/search?q=site%3Anews.ycombinator.com+%... )

Why? That's easy: I made a deal with Randall Munrow and as a result I'm legally obligated to post links to XKCD comics all over the web! Seriously though. I enjoy reading XKCD and the first thing I thought of when I read the title of the post was that comic. Sorry for offending your delicate sense of humor. ;)

(nbpoole, I think Reddit-like humour is wasted here on HackerNews.)

Re: Hidden features of Python - Stack Overflow

#13
post #4

Obligatory XKCD: http://xkcd.com/353/

XKCD is never obligatory. Seriously, why is anyone "obligated" to post a comic that mentions Python, but adds nothing of substance, and isn't even funny? ( http://www.google.com/search?q=site%3Anews.ycombinator.com+%... )

Let's be fair. It was funny the first time I saw it.

Re: Hidden features of Python - Stack Overflow

#14

Hidden features in a programming language? Granted, most of these aren't "hidden", but they're nonobvious because the language is incredibly complex and it's difficult to predict from first principles that any of these things would actually work. Long ago, a rule of programming language design was handed down by the great old hackers, but it has been forgotten and much needless effort has been spent as a result. It's…

I think Guido is well aware of that rule, and makes a conscious effort not to add unnecessary features to the language. Still, there's no way you can maintain any non-trivial piece of software for 20 years and not have a few unexpected "features" come up.

Re: Hidden features of Python - Stack Overflow

#15
post #13

Earlier quoted context omitted.

XKCD is never obligatory. Seriously, why is anyone "obligated" to post a comic that mentions Python, but adds nothing of substance, and isn't even funny? ( http://www.google.com/search?q=site%3Anews.ycombinator.com+%... )

Let's be fair. It was funny the first time I saw it.

[deleted]

Re: Hidden features of Python - Stack Overflow

#16
post #13

Earlier quoted context omitted.

XKCD is never obligatory. Seriously, why is anyone "obligated" to post a comic that mentions Python, but adds nothing of substance, and isn't even funny? ( http://www.google.com/search?q=site%3Anews.ycombinator.com+%... )

Let's be fair. It was funny the first time I saw it.

Damning with faint, faint, faint praise.

ObPython: Learn Smalltalk too!

Re: Hidden features of Python - Stack Overflow

#17
post #10

Hidden features in a programming language? Granted, most of these aren't "hidden", but they're nonobvious because the language is incredibly complex and it's difficult to predict from first principles that any of these things would actually work. Long ago, a rule of programming language design was handed down by the great old hackers, but it has been forgotten and much needless effort has been spent as a result. It's…

Can you go into specifics about how any of these examples are non-obvious because the language is incredibly complex? In the context of higher level and or dynamic languages, I'd argue that Python is rather low on the complexity scale

Yes, and some of those `hidden features' are just nice library functions that avoid adding features to the core language. Look at `enumerate' and `zip' for example, which allow Python to get away with one very simple for-loop.
Post reply on HN