← Home ← Back to /g/

Thread 105856531

26 posts 4 images /g/
Anonymous No.105856531 >>105856561 >>105856607 >>105858718 >>105859439 >>105859767
just returned from an Interview
i studied python, design patterns, i learned abstract classes, threads, multiprocessing,... i was ready for it all


>what is the else clause in for, for?
excuse me, what?
>the else, in for loop sir
i'm sorry you mean if else, inside a for loop?
>sir we really appreciate your time for this interview *pats me on the back + smile


WHAT THE FUCK DUDE
Anonymous No.105856561 >>105856573 >>105856585 >>105856782
>>105856531 (OP)
the for else construct in python is very stupid but it does exist, given that you not only picked python, you aren't aware of it's syntax and that you tried to correct the interviewer when you were wrong really looks bad on you.
Anonymous No.105856566 >>105856584
Do retards really use the else clause of for loops in python? It's probably the stupidest shit in the whole language.
I can never remember if it's run on gotos (break) or not either or if it's just a finally block for a loop in disguise.
Anonymous No.105856573
>>105856561
No, he's right to mock the interviewer for even mentioning it.
Anonymous No.105856579
Memorizing language constructs is a stupid thing to ask since you don't need any skill or thinking to answer that, but they probably thought for-else was rudimentary enough in python for you to know it

Is it the first language you learned?
Anonymous No.105856584 >>105856631
>>105856566
Yes, it's very useful for cleanly knowing if you haven't exited early from a loop instead of using some flag variable
Anonymous No.105856585
>>105856561
Everyone pretends python's syntax is simple but it's one of the more complex languages syntactically.

Never let the FP autism into your programming language. Not even once.
Anonymous No.105856589 >>105856604 >>105856608 >>105856620
OP being a dumb frogposter who doesn't understand his own language of choice aside, what is the point of these interviews? Your awareness of specific nice structures of a language doesn't make you a good engineer, you can Google that shit in 5 minutes if you ever encounter it and it won't make your code better if you use it. A software engineer needs to understand which algorithms to use and when to use them, and how to write performant and secure code, not arcane bullshit in the language standard
Anonymous No.105856604 >>105856616
>>105856589
You clearly don't have a job. 95% of programming is code to move data around and abstractions over that that make sense for your business logic. No one writes "algorithms" except for niche cases.
Anonymous No.105856607
>>105856531 (OP)
Don't worry, they were probably a shitty place to work for. Knowing for/else doesn't matter but they were just testing to see if you had crammed obscure Python syntax, as a proxy for whether or not you really wanted the job.
Anonymous No.105856608 >>105856616 >>105856617
>>105856589
>doesn't make you a good engineer,
It's better than it initially seems. The more time you spend reading random code in a language the more you'll trip over weird stuff like this. It indicates familiarity which is otherwise super hard to test for in such a short period of time.

Remember: what they want is someone who can absorb complexity and produce solutions by becoming familiar with their insane corporate code base. It's not about being a good programmer, it's a weird social+strength thing. That's why interviews are so weird.
Anonymous No.105856616 >>105856630
>>105856604
>>105856608
So it's a code monkey position? OP never had a chance, he can't compete against an indian
Anonymous No.105856617
>>105856608
Yeah but you can't assume interviews are also perfectly put to meet this.
Anonymous No.105856620
>>105856589
Right but the point was that he could have asked to google it in 5 minutes or he could have been a fucktard and go "lol wut u mean [wrong thing] right?" 100% deserved.
Anonymous No.105856630
>>105856616
code monkey is when you don't reimplement quick sort 10 times each day
Anonymous No.105856631 >>105856638
>>105856584
How? I just checked and it's even worse than I remember. Else verbiage imo implies early loop exit or maybe semantically could be, if-never-ran (as in empty iterator). Simply executing on loop end without break is retarded.
Anonymous No.105856638
>>105856631
Language constructs don't have to make sense to you
Anonymous No.105856782
>>105856561
saar please
Anonymous No.105858718 >>105859423 >>105859439
>>105856531 (OP)
>he didn't read the official documentation
https://book.pythontips.com/en/latest/for_-_else.html
unironically ngmi
Anonymous No.105859340
you made it up
Anonymous No.105859423
>>105858718
>"the official documentation"
>quotes not the documentation but literally the first google result of "python for else"
you're ngmi either
Anonymous No.105859439 >>105859446
>>105856531 (OP)
>>105858718
>for loops also have an else clause which most of us are unfamiliar with. The else clause executes after the loop completes normally. This means that the loop did not encounter a break statement.
>Using break inside a for
>Using break at all
Sirs...
Anonymous No.105859446
>>105859439
abandoning goto has been a disaster for programming
Anonymous No.105859449 >>105859479
for (int i = 0; i < n; ++i) { ... } else { ... } should the else branch be taken when i < n on the first iteration or act more like finally in common lisp
Anonymous No.105859479
>>105859449
Definitely the latter. Reading that I would not expect the else clause to execute until i < n is false.
Anonymous No.105859767
>>105856531 (OP)
When interviewers use shitty gotcha/brain teaser questions like this it means they didn't want to hire you in the first place.