Not in a language with short circuiting.
Comment on The Legends is among us
kernelle@0d.gs 9 months agoThe problem with this in the OP is the first ‘if’ checks if the object exists and the second gets a property of said object only if the original object exists.
I’m not saying the OP is good code, but chaining them like this would result in exceptions.
rothaine@lemm.ee 9 months ago
kernelle@0d.gs 9 months ago
Could’ve sworn I’ve had this issue before! Maybe not with python
rothaine@lemm.ee 9 months ago
Yeah not all languages do it. I find it rather convenient though
fushuan@lemmy.blahaj.zone 9 months ago
The language is python and it has short circuiting aka in an and condition, if the first block isn’t fulfilled the second one isn’t tested because it’s unnecessary.
Same with or and the reverse.