Skip to content

Move constants to attributes #104

@ntessore

Description

@ntessore

The chance that an existing implementation matches the exact namespace and name of the defined constants is slim (I don't know any code that does). Therefore, it's fair to say all existing codes must do some wrapping of their constants to conform to the API. In which case it is much more straightforward for everyone to have the constants in the cosmo object itself:

class HasC(Protocol):
    @property
    def c(self) -> Any:  # noqa: ANN401
        """Speed of light in km s-1."""
        ...

class HasG(Protocol):
    @property
    def G(self) -> Any:  # noqa: ANN401
        """Gravitational constant G in pc km2 s-2 Msol-1."""
        ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions