On Mon, 2009-08-03 at 10:06 +0400, Ivan Sagalaev wrote:
> Brent Hagany wrote:
> > The issue of making shortcuts better (and decreasing the number of
> > imports in views.py files) was brought up at DjangoCon
> 
> Another angle on the issue of reducing imports is that we can do it not 
> with shortcuts only but by packing some smaller modules into larger 
> ones. For example just yesterday I've stumbled upon this in my views:
> 
>      from django.views.decorators.http import require_POST, condition
>      from django.http import HttpResponse, HttpResponseRedirect, \
>          HttpResponseForbidden, HttpResponseBadRequest, Http404
> 
> And thought that it would be way better to merge both modules into a 
> django.http and then I could just
> 
>      from django import http
> 
> and use everything in it with just a 5-letter prefix.
> 
> What people think about it?

As a general process, I'm inclined to think it's the wrong direction --
making namespaces larger and larger. That way lies PHP or web2py. You
can already write

        from django.view.decorators import http as decs
        from django import http

and it's two short lines. I think, though, that this shows the real
problem: we have a few overlapping names like this that are unfortunate
and historically entrenched. I wouldn't be thrilled about compromising
on separation of responsibilities to avoid an "as" import too much like
that.

I mean, really, imports are such a small part of the process and so easy
to make easier without jamming things together too much.

Not sure there's any perfectly ideal situation here. We have a history
that leads to certain things being named in certain ways. Working out
how to jam things together won't result in everybody being pleased in
any case.

Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to