r/programming • • May 09 '12

JavaScript: The good parts

http://blog.movereem.nl/images/javascript-the-good-parts-the-definitive-guide.jpg
645 Upvotes

159 comments sorted by

View all comments

Show parent comments

5

u/kqr May 09 '12

Do you not want to be able to pass print to a higher-order function?

4

u/Traubert May 09 '12

That's possible even if print is kept as a keyword too. You can do it in any of the 2.x versions that provide print as a function.

6

u/kqr May 09 '12

How do you pass it? It just syntax errors me when I try.

-2

u/sli May 09 '12

Why would you want to pass it and not simply use it normally?

2

u/cacahootie May 09 '12

You're joking, right? Metaprogramming is super powerful in Python.

→ More replies (0)

1

u/HorrendousRex May 09 '12

It could be useful in some circumstances I suppose where functions are passed first-class in to the arguments of other functions, to print out the order the callbacks are being called in. Although at that point I can't help but feel that something like:

lambda x: print x

might be just fine. Or better yet, import py3k's print from __future__.

→ More replies (0)