Content-Length: 284719 | pFad | https://github.com/python/cpython/issues/91928

88 Add `datetime.UTC` alias for `datetime.timezone.utc` · Issue #91928 · python/cpython · GitHub
Skip to content

Add datetime.UTC alias for datetime.timezone.utc #91928

@pganssle

Description

@pganssle

Feature or enhancement

Right now, the UTC singleton is only available as a class-level attribute on datetime.timezone, but I think a lot of people would probably like to be able to do this:

from datetime import UTC

Since datetime.timezone is a class, not a module, right now it is necessary for each person to define their own UTC alias (if they want such a thing) in two lines:

from datetime import timezone
UTC = timezone.utc

This isn't a huge deal, but I think it would be pretty unambiguous what it refers to and might be a nice quality of life improvement.

CC: @abalkin

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/91928

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy