abseil/abseil-py

Add an optional only_if_main arg to allow placing flags.mark_flag[s]_as_required next to the flag definitions

privman opened this issue · 1 comments

There's a readability benefit in placing flag validations together with the flag definitions. However, flag definitions are customarily placed near the top of the file, while the main block (if __name__ == '__main__':) is customarily placed at the bottom of the file. If we add an only_if_main arg that allows suppressing the behavior when the module is imported, users will be able to place calls to flags.mark_flag_as_required and flags.mark_flags_as_required wherever they wish.

See #150.