⬅︎ Back to Django ORM optimization story on selecting the least possible
I came to say the same; at the very least this would be much cleaner.```def f4(a): names = Song.objects.filter(artist=a).values_list("name", flat=True): return hashlib.md5("".join(list(names)).encode("utf-8")).hexdigest()```
You don't need the for loop, right? You can pass the django query directly to ''.join.
That is no different. Just styled differently.
Comment
I came to say the same; at the very least this would be much cleaner.
```
def f4(a):
names = Song.objects.filter(artist=a).values_list("name", flat=True):
return hashlib.md5("".join(list(names)).encode("utf-8")).hexdigest()
```
Parent comment
You don't need the for loop, right? You can pass the django query directly to ''.join.
Replies
That is no different. Just styled differently.