Just a short question about coding style and possible shortcuts for
django-users. I know this is a very minor issue, but I'm just curious...
Currently there are some - I count eight - places where wraps() get
imported, they all look something like:
----------8<----------------------------------------------------
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
---------------------------------------------------->8----------
After needing to use wraps() myself I wondered why we could not just use
"from django.utils.functional import wraps" everywhere inside django.
functional.py could do the error-catching and import from functool if
possible.
----------8<------------------------------[ functional.py ]-----
try:
from functools import wraps, update_wrapper
except ImportError:
# Python 2.3, 2.4 fallbacks:
def wraps(...): ...
def update_wrapper(...): ...
---------------------------------------------------->8----------
I know, this is a question about coding-style, but I think needing only
to import from django (meaning only needing one line instead of four)
cleans up your files a little. Additionally importing from django by
mistake would not cause to have two different versions of
wraps()/update_wrapper() around (as functools might get updated some day).
So are there any reasons to keep the current imports as they are? If
nobody has strong feelings against this I could provide a simple patch.
Perhaps the question can be extended to other imports as well...
Btw.: There are already places where normal python modules are wrapped
by django. So this would not break current coding-styles I think.
(Example: django.utils.http.urlquote, but this is somewhat different)
Greetings, David Danier
P.S.: I did not open a ticket on this, as I think, this needs discussion
and such minor issues should not flood trac.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---