22 karma · joined Jul 31, 2016 (10y ago) · 15 submissions
comment 4y ago · link · parent
You still depend on a database with the `Task` model. This would be a no-go for that reason, since there's no reasonable way to have an impact on its behaviour, outside of creating a custom database router to avoid having every third-party library hitting the same database as core logic.
If you absolutely must use a model, take a look at enumeration types[1] for a slightly "neater" way to declare choices.
[1]: https://docs.djangoproject.com/en/4.1/ref/models/fields/#enu...
comment 4y ago · link · parent
comment 4y ago · link · parent
I do get emails from the CA reminding me to renew a month or so before expiry, and the certificate hasn't been revoked as of yet, but it'd be useful to be alerted regarding the latter, were it to happen.
comment 4y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
import functools
def fizzbuzz(n):
if not n % 3: yield (r := "fizz")
if not n % 5: yield (r := "buzz")
if not "r" in locals(): yield n
compose = lambda f, g: lambda *args: f(g(*args))
functions = "".join, functools.partial(map, str), fizzbuzz
transform = functools.reduce(compose, functions)
print("\n".join(map(transform, range(1, 100))))comment 5y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent