Skip to content

Decorator to allow only subset of short metric prefixes to help avoid unit naming conflicts #746

@pql9132

Description

@pql9132

Unit "molar" cannot accept a short alias of "M" as well as accept metric prefixes, despite being ubiquitously used in chemistry, due to a conflict with the alias "RM" for Malaysian Ringgit and the metric prefix "R" (ronna).

The convenience and intuitive ease of use for chemistry applications would be greatly improved by the use of "M" as an alias for "molar" along with metric prefixes, however it would also be an issue to remove the symbol for the Ringgit currency to accomplish this.

However, such convenience and ease would not require any short metric prefixes for "molar" outside of a much more limited range of magnitudes, as this unit is rarely used outside of attomolar - molar.

It would be useful to reduce the occurrence of unit naming conflicts to allow only a more limited range of "common" short metric prefixes.

The range of SI prefixes was extended on several occasions. So a natural way to limit prefix use would be by the year of official introduction. The lower and upper range of unit prefix magnitudes by year of adoption was:

  • 1795: milli-kilo
  • 1960: pico-tera
  • 1964: atto-tera
  • 1975: atto-exa
  • 1991: yocto-yotta
  • 2022: quecto-quetta

A possible syntax would be:
@metric_prefixes

to allow all as before, and

@metric_prefixes(short_before=1991)

to enable only those before a given year.

Alternatively, rather than enable groups prefixes, a decorator could restrict a set of prefixes from use, such as:

@metric_prefixes
@exclude_prefixes(R, Q, r, q)

to exclude "ronna"/"ronto" and "quetta"/"quecto" (for example).

Or as a third proposal, rather than using year or exclusion list, a maximum order of magnitude away from the base unit for short prefixes could be specified, such as:

@metric_prefixes
@prefixes_range(short=9)

to allow short units in the range of 10^(+/-9) [nano-giga] for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions