Skip to content

time module: rename to_time() to to_clock() for clarity #1456

@SchoolyB

Description

@SchoolyB

Context

The time module has a function to_time() which actually formats a string into a timestamp. The name reads like "convert something to a time value" but in practice it is the inverse of to_iso() / format(). This is misleading.

Proposal

Rename to_time() to to_clock(). time.parse(str) reads correctly and matches the convention of other parsing functions across the stdlib.

Not changing

  • to_iso() — correctly named (converts timestamp to ISO string)
  • format() — correctly named
  • date() — correctly named (specialized format shortcut)

An earlier audit flagged these as overlapping; on second look they are just convenience shortcuts around format(), which is fine. No redundancy to address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeChanges that break backward compatibilityenhancementNew feature or requeststdlibGeneral standard library issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions