Most of the time I use `timezone.now` in conjunction with 
`timezone.timedelta`, however, today I realized it was not publicly 
exported in the module.

Most of the time,  using it saves an import from `datetime` (e.g., 
timezone.now + timezone.timedelta is a common pattern). I presume this use 
case is a common one among Django developers. I made a quick Stack Overflow 
search, which yielded 100+ results:

https://stackoverflow.com/search?q=timezone.timedelta+%5Bdjango%5D

Then I thought, why stop there? Usage of `timezone.datetime` would possibly 
reduce the `datetime` imports to zero in some Django projects. However it 
is not used as much, as you can imagine:

https://stackoverflow.com/search?q=timezone.datetime+%5Bdjango%5D

I would say we should at least consider exporting `timedelta` What do you 
think?


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1365872e-88f5-4c15-bbf0-0a41cc68c7cfn%40googlegroups.com.
  • Exp... suayip uzulmez
    • ... Mariusz Felisiak
      • ... Jacob Rief
        • ... Mariusz Felisiak
          • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
            • ... Bogdan Barna

Reply via email to