3 ms·
Advice on the Parameters class: implement attribute access (__getattr__) in addition to __getitem__. Compare f"""... WHERE created_on > {p['created_on']}} ..
by oefrha 6y ago
Advice on the Parameters class: implement attribute access (__getattr__) in addition to __getitem__. Compare
f"""... WHERE created_on > {p['created_on']}} ..."""
to
f"""... WHERE created_on > {p.created_on} ..."""
The latter is a lot more readable and typeable, especially when it's meant to be used in f-strings which place additional restrictions on the usage of quotes.