4 ms·
result = case when baz>10 then foo else bar end is a translation of if baz>10: result = self.foo() else: result = self.bar() while r
by Dylan16807 16y ago
result = case
when baz>10 then foo
else bar
end
is a translation of
if baz>10:
result = self.foo()
else:
result = self.bar()
while
result = if baz > 10
foo
else
bar
end
is a translation of
result = self.foo() if baz>10 else self.bar()
It's true that some things have to be changed when translating, but you can't ignore the deliberate structure of the original. Let's say I want to look at how inter-sentence objects work in two languages. I give you the phrase: "Raining cats and dogs. This is what the weather is like." You can't translate it as if it said "It's raining cats and dogs" without losing the basis of comparison entirely.