logoalt Hacker News

shantnutiwaritoday at 9:23 AM8 repliesview on HN

" but the interview engine is already running at full speed:"

I dont know if this is a recent thing, but I had a similar thing where an interviewer was racing forward, and would only accept the answers he had in mind.

In Python, he asked me how to search for substring. I was thinking but he started hurrying me. So I said regex and started writing a regex.

"No, there is an inbuilt method"

I couldnt remember the method. He asked me to google it, but there are dozens of string methods.

"I could use a regex?" I said and tried to show him how.

He ended the call, and 5 min later the agent called me to say my Python was sun-standard so they wouldnt be going forward.

This guy was a permanent employee and supposedly an expert


Replies

bee_ridertoday at 3:43 PM

I’d call this an understandable mistake on the part of the interviewer. “in” is a pretty commonly used operator. But it is also a bit unusual/trivial, in the sense that most languages would have a method or a function instead.

It’s the sort of thing where if you’ve written, like, any Python at all, it’ll be somewhere in the back of your head. It’d surface immediately on the job. But if you’d been using any other language earlier that day, it might not pop up reflexively, or in interview-stress mode.

It’s essentially trivia, and over-indexing on trivia is a mistake. But if they were a Python writer every day, I could see why they’d incorrectly expect everybody to have “in” in their l1 cache.

show 2 replies
gspetrtoday at 4:13 PM

Step 1: https://www.google.com/search?q=list+python+string+methods

Step 2: Parse the output with your eyes. The method is literally called "find".

This one-trick pony failure mode could perhaps have been fine for a guy who did Java and nothing but Java for 10 years, but you are supposedly the person who runs "pythonforengineers" website...

100% correct call by the interviewer.

show 1 reply
anktortoday at 10:31 AM

Commenting just to go against the other two answers. I think it's fine to not remember things, no matter the apparent simplicity.

Quite surprised by others finding this as a... Surprise? I get there is people who never experience this, but they also not know anyone personally to whom this would happen?

show 1 reply
Kim_Bruningtoday at 1:02 PM

   if "needle" in haystack:
      print ('haystack.__contains__("needle")')
Is probably the obvious/canonical answer to the question of trying to find a substring.

So obvious that -to be fair- I blanked for a moment too. But 'in' is an operator, not a method (even though it calls __contains__ under the hood) . The question might have been slightly malformed?

show 1 reply
stemchartoday at 9:50 AM

I probably would've done the same. "I don't remember what the function is called" would've been fine-ish, but reaching for a regex is just insane.

show 4 replies
teiferertoday at 11:40 AM

I like such interviews. They tell me it's not a place I want to work at without wasting much time finding out.

raincoletoday at 9:50 AM

He was being rude, but I'm equally baffled by your description. It was very weird that you couldn't figure out which method is to search for substring when you have access to google search.

And it was triply weird that when he already said he wanted the non-regex way and you insisted on that.

show 2 replies
jubilantitoday at 3:12 PM

The interviewer was right. If you don't know "if substring in string" by memory, your python programming is substandard. This should be automatic for anyone who works with python as a primary language. But if you can't even Google to find "if substring in string", why would anyone pay you even minimum wage to be a programmer?

show 1 reply