Skip to content

Unnecessary list copies in zoneinfo._common.load_tzdata #141970

@frostming

Description

@frostming

Bug description:

This specific lines in the module:

components = key.split("/")
package_name = ".".join(["tzdata.zoneinfo"] + components[:-1])
resource_name = components[-1]

Creates a list copy with components[:-1] which can be avoided by using list unpacking, which would affect the performance slightly.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directorytype-refactorCode refactoring (with no changes in behavior)

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions