3 ms·
I think it depends on how you deduplicate your code. Creating a DeadlineSettter as illustrated is definitely too much, but creating a function: def assert_da
by chacham15 2y ago
I think it depends on how you deduplicate your code. Creating a DeadlineSettter as illustrated is definitely too much, but creating a function:
def assert_datetime_in_future(datetime):
if datetime <= datetime.now():
raise ValueError(
“Date must be in the future”)
and then calling that from both places seems fairly reasonable to me.
- 12_throw_away 2y agoRight? Creating a noun instead of a verb is the real anti-pattern I see here. (Once you have a DeadlineSetter, it's a slippery slope down to ClassInstanceFactoryConfigProxyManager, etc.)