[Note] About django not forgiving you print()’s you left in production

Using print() is a natural way to work through some tricky tasks anywhere. But particularly in Django you want to double-check that there aren’t any print() left in your code.

It takes a long time to print(). Here is a thread about different ways to print an output with Python. Generally it says that it depends on a terminal you use, but generally terminals don’t do I/O buffering.

What kind of code we may want to print()? QuerySet, joined lists – some data that can be considered big for Django. Those tests were performed on 100k lines, and considering data we normally want to print in Django projects, it looks adequate the test.

Django is not the fastest horse, but it can run not only derby, but play football and even show a trick or two on a paddle court. That saying, it is important to not unnecessarily bother it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.