Hello, Stu casually proposed yesterday adding a de...
# development
h
Hello, Stu casually proposed yesterday adding a dedicated
unions
backend registration hook and I’m wondering which you all prefer?
Copy code
def rules():
  return [UnionRule(Linter, BanditLinter), UnionRule(Linter, BlackFormatter)]
vs.
Copy code
def unions():
  return {Linter: [BanditLinter, BlackFormatter}
@hundreds-breakfast-49010 and I don’t think one is obviously superior.
Some pros of
unions()
- Less verbosity when registering multiple unions - Dicts are more ergonomic than
UnionRule
Some cons of
unions()
- Suggests that you’re overriding the union, when really you are just augmenting it - Possibly more boilerplate in
register.py
when we import each file and now have to call
my_file.rules()
and
my_file.unions()