Contrary voice here, but I don't dig explicit relative imports, it's just 
adds an extra decision point for no real benefit.

Personally I always recommend full absolute imports, ordered strictly 
alphabetically - there's then never any room for confusion or decision 
making around how the imports should be written, and it's always tidy and 
consistent.

Not looking to necessarily change the Django project's stance on that, but 
that's the style I use throughout my projects and it's trivial to stick to. 

Cheers,

  Tom

On Wednesday, 12 November 2014 21:59:42 UTC, Jannis Leidel wrote:
>
>
> > On 11 Nov 2014, at 22:51, Aymeric Augustin <
> aymeric....@polytechnique.org <javascript:>> wrote: 
> > 
> > Hello, 
> > 
> > We’ve started using explicit relative imports in newer parts of the 
> Django source tree. They’re short and readable. That’s good. 
> > 
> > I would like to add guidelines about imports in the coding style guide 
> in order to improve consistency. 
> > 
> > My inclination would be to recommend relative imports within 
> “components” but avoid them between “components”, where a component is: 
> > 
> > - a well-defined sub-framework (django.core.cache, django.db, 
> django.forms, django.template, etc.) 
> > - a contrib app 
> > - an app in the tests/ directory 
> > - etc. 
> > 
> > I would discourage going back into parent modules with relative imports 
> because statements such as `from ...spam import eggs` are hard to parse. 
> > 
> > You can see an example of this style in django.apps which has only three 
> files. 
> > 
> > What do you think? 
>
> Yup, the way to go. 
>
> Jannis

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7f1a5323-1efd-4891-bc02-eab5d67bc8b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to