I love all kinds of soup and it’s the one type of meal where I can truly go insane with the amount of hot sauce I put in it. An amount that would probably make these soup-hating boys cry.
I’m sure they have all the heuristics in Cloudflare cranked up due to all programming model training aggressively digesting their content. Can’t blame them, honestly.
I think pythonic is more important than performance and I would still choose that version over a try-catch block, were it slower. Being pythonic means it represents a commonly understood pattern in Python code, therefore it is more efficient in communicating intent.
Apart from the quote from the zen of python, does this really make your code better though? You will end up writing 4-5 lines with an extra level of indentation. The code does the same, but has worse performance and communicates the intent poorly (compared to the “pythonic” version).
I love all kinds of soup and it’s the one type of meal where I can truly go insane with the amount of hot sauce I put in it. An amount that would probably make these soup-hating boys cry.