Not specific to Godot but I prefer the second one. The if breaks the flow of reading IMHO. You could add a comment to explain the whole thing though.
No judgement but why is it not called set_value instead of set_default_value? And why is it returning a value? I'm a noob at Godot.