All Questions

Community

p
produno
posted to: Drawing Rooms

Question on object.call usage.

Why do we use 

call("_ready_editor_hint" if Engine.editor_hint else "_ready_not_editor_hint")
Rather than

if Engine.editor_hint:
       _ready_editor_hint()
else:
       _ready_not_editor_hint()

Would we not be better off trying to avoid using strings where possible?

  • GDQuestions replied

    It's an implementation detail, there's no particular reason. This teammate's used to functional programming styles and favoring expressions over blocks.

    In general, sure, you want to avoid using strings to get errors before runtime. In this case, because you'll always run this, if there's an error, you'll catch it early so it's not too important.