I agree with Mariusz. Encouraging alternative import paths for standard library functions can only lead to confusing code.
On Mon, Mar 20, 2023 at 11:47 AM Mariusz Felisiak < felisiak.mari...@gmail.com> wrote: > > I find it confusing that we have to import now from django.utils.timezone, > but timedelta from Python's internal datetime. > This btw. is a violation of the Law of Demeter > <https://en.wikipedia.org/wiki/Law_of_Demeter>, hence I agree with > Suayip's proposal. > > – Jacob > > > There is a big difference between `now()` and `timedelta`, > `django.utils.timezone.now` is defined in Django it is not the same as ` > datetime.now`. Unlike, `timedelta` would be always Python's `datetime. > timedelta`. Following this proposition, we should reintroduce most of the > standard Python libraries in the django.utils modules 🤯 TBH, we're > trying to do the exact opposite and remove all aliases, e.g. > https://github.com/django/django/commit/d6816bff73b37af05c968c009419c7c608e37307 > > I remember a discussion where a user tried to convince me that ` > django.utils.timezone.datetime` is not the same as `datetime.datetime` > and that Django is definitely adding some magic here and I have to use > `datetime` from Django. This is of course not true. > > Best, > Mariusz > > -- > 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/40cce83a-4967-4a6c-9ae2-7e15386814dcn%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/40cce83a-4967-4a6c-9ae2-7e15386814dcn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAMyDDM1UCrdbvT0YRuyET%2B0dmMgajPvy_VzES6ub69CbPGPTuw%40mail.gmail.com.