Hacker Newsnew | past | comments | ask | show | jobs | submitlogin



Strange.

I'm going to have to disagree with the BFDL here. Tuple parameters are probably not used much because people don't know about them, not because they're unhelpful. And all the code transformations he shows below end up longer. And they don't seem to be any easier to read. :-/

Consider what PG says in the arc tutorial.

"Since functions of one argument are so often used in Lisp programs, Arc has a special notation for them. [... _ ...] is an abbreviation for (fn (_) (... _ ...)). So our first map example could have been written

  arc> (map [+ _ 10] '(1 2 3))
  (11 12 13)
Removing variables is a particularly good way to make programs shorter. An unnecessary variable increases the conceptual load of a program by more than just what it adds to the length."

It's strange that this would be what pushes me over the fence, but I think Python and I are going to end up parting ways...


  q)10+1 2 3
  11 12 13


No. I have to say, I agree with the BDFL here. Tuple unpacking in function headers is prone to bugs and can lead to ambiguous behaviour.

It also doesn't fit very well with other features like keyword arguments.

You are right that the extra variable leads to extra mental overhead but so does potential ambiguous behavior.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: