Hacker News new | past | comments | ask | show | jobs | submit login

wantarray() is a sensing operation that allows a type of transparent function overloading: Oh you wanted just a scalar? OK.

Python's ordered arguments mixed with out of order labeled arguments is worse IMO: Tell me arguments in this order. Or not... I mean, you could just tell me which they are. Wait, I got two of these... F*ck this, I quit




Isn't Python's mixing rules very simple?

(1) Un-named arguments come before any named arguments and should be passed in order (this is familiar to programmers in almost any mainstream language).

(2) Named arguments can then follow, in whatever order.


Yes, they not complicated, and I imagine it's a non issue for most.

The interface is awkward however in that in other languages you would overload the function or pass a data structure, or reference of one, to manage additional optional parameters when you didn't want the extra arguments explicitly listed.

Python is a popular language and there are a ton of contributors who have developed third party packages. Unfortunately, these are not always well written or maintained and it can be easy to stumble across a bad one when looking for useful things. It's never fun to debug code in an unfamiliar language.


Yes but if you want to know an arrays length you can just put it in a scalar. So you consume some API and want to get the length of the result. You put the array result into a scalar variable. Then what this is not the length?


The API documentation should reflect that the result is context sensitive. Not reading that is a good way to get burned despite the language.

Perl is well known for it's multitude of idiosyncrasies, this is one of the reasons why it can be frustrating to programmers who have better experience in more modern or rigidly structured languages.


That particular API would have been much better had it been documented.


If only there was some well written book about Learning Perl, or well written documentation in the form of manual pages (see perldata).


That doesn't cover this particular third party API.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: