Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For the <code>\</code> at least: it's common to want lines to contain at most 80 characters (there are many reasons for this; makes it easier to read or to have multiple files open side by side, never have to scroll, convention/tradition, etc.). The <code>\</code> makes it possible to break a (logical) line into several actual lines without causing indentation errors.</p> <p>The first example, without the backslash, might be written</p> <pre><code>from django.contrib.admin.util import get_model_from_relation, reverse_field_path, get_limit_choices_to_from_path </code></pre> <p>Notice how you have to scroll right to see the whole thing, which is awkward. An alternative for keeping those imports to 80 characters would be</p> <pre><code>from django.contrib.admin.util import get_model_from_relation from django.contrib.admin.util import reverse_field_path from django.contrib.admin.util import get_limit_choices_to_from_path </code></pre> <p>But now you have to repeat the imported module, which is ugly. Ultimately it comes down to a matter of style/personal preference.</p> <p>More generally, it's not uncommon for library code to look messy or unconventional -- sometimes you sacrifice the cleanliness of the implementation in the interest of exposing a nicer interface. Django in particular is often guilty of this. The syntax for declaring models, for instance, or for customizing the admin site, or the whole business with using keyword arguments to make database queries -- it's all really nice to use, but the code that makes it all work can be hard to wrap one's head around.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload