Created
July 8, 2020 23:17
-
-
Save pydanny/6cf5f6344a59a655cf885dd86eefd5b2 to your computer and use it in GitHub Desktop.
Which one is more legible?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fun_function(name=None): | |
"""Find working ice cream promo""" | |
results = Promo.objects.active() | |
results = results.filter( | |
Q(name__startswith=name) | | |
Q(description__icontains=name) | |
) | |
results = results.exclude(status='melted') | |
results = results.select_related('flavors') | |
return results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fun_function(name=None): | |
"""Find working ice cream promo""" | |
return ( | |
Promo.objects.active() | |
.filter( | |
Q(name__startswith=name) | | |
Q(description__icontains=name) | |
) | |
.exclude(status='melted') | |
.select_related('flavors') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first one! It is easier to debug with
breakpoint()
(.set_trace()
), debuggers or even "debug printing".