Hacker News new | ask | show | jobs
by jcranmer 2423 days ago
I routinely use several languages, and am constantly forgetting which ones use .size() and which ones .len(). It's not worth committing to memory because, if I get it wrong, the compiler will tell me "what is this function of which you speak?", and I will simply turn around and use the other one, at which point it starts compiling again, wasting me at most a minute of my time.

Furthermore, I should point out that it's not out of the imagination that someone wouldn't use len() all that heavily. Python has functional operators that let you do map/reduce-style operations on lists, strings, dicts, etc. that don't require you to use length all that much. My most recent python script only uses len() in two places for more robust error reporting.

1 comments

Well... try not to take this personally, but... that means that you're not really an expert in Python, which is what (I assume) the interviewer in the linked post was looking for. You're capable in several languages, and may be an expert in one or more of them, but if they're looking for Python expertise, asking you how to find the length of a string is a good way to get a feel for how much time you're going to need to get to where you can really be trusted to produce mission-critical Python software (which may not be a deal breaker, if you're good at a lot of other things).