# PEP 737 – Unify type name formatting

**URL:** <https://discuss.python.org/t/pep-737-unify-type-name-formatting/39872>\
**Category:** PEPs\
**Created:** [November 29, 2023, 1:00pm UTC](https://discuss.python.org/t/pep-737-unify-type-name-formatting/39872 "2023-11-29T13:00:27Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [December 14, 2023, 10:02pm UTC](https://discuss.python.org/t/pep-737-unify-type-name-formatting/39872/34 "2023-12-14T22:02:30Z")

</div>

> [@jamestwebber](#):
>
> Are you proposing to add five specifiers for types to the [string format specification](https://docs.python.org/3/library/string.html#formatstrings)?

The existing [string format specification](https://docs.python.org/3/library/string.html#formatstrings) is used by numbers: ` __format__ ()` methods of `int`, `float`, `complex`, and `decimal.Decimal`.

I propose to have a different format spec only used by `type. __format__ ()`. Are there reasons to use the same format spec for all stdlib types?

There are other existing stdlib types which use a different format spec, such as `datetime.datetime`:

```auto
>>> import datetime; d=datetime.datetime.now(); f"{d:at %Hh%M}"
'at 22h56'

```

Other examples:

- `ipaddress.IPv4Address`: `b`, `X`, `x` and `n` formats
- `fractions.Fraction`: use the same format spec than int
- `enum.Enum`: similar to `format(str(value), format_spec)`

---

_[View the full topic](https://discuss.python.org/t/pep-737-unify-type-name-formatting/39872)._
