ToTemp Module

Classes to represent temperature scale objects, providing arithmetic and comparison operations between them.

Base Class

All classes inherit from this one. Here are all of the special and common methods docs.

class totemp.temperature_types.AbstractTemperature(value)

Bases: object

Abstract base class for all temperature types.

Attributes
_symbolClassVar[str]

Official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

Methods

rounded()

returns a new object of the same class with the value converted to int.

to_celsius()

returns a Celsius object which contains the converted value.

to_fahrenheit()

returns a Fahrenheit object which contains the converted value.

to_delisle()

returns a Delisle object which contains the converted value.

to_kelvin()

returns a Kelvin object which contains the converted value.

to_newton()

returns a Newton object which contains the converted value.

to_rankine()

returns a Rankine object which contains the converted value.

to_reaumur()

returns a Réaumur object which contains the converted value.

to_romer()

returns a Rømer object which contains the converted value.

convert_to(temp_cls)

returns an instance of temp_cls which contains the converted value.

str(self)

Returns the “informal” or nicely printable string representation of self.

Returns
self.__str__()str

f’{self._value} {self._symbol}’

rtype

str ..

repr(self)

Returns the “official” string representation of self.

Returns
self.__repr__()str

f’{self.__class__.__name__}({self._value})’

rtype

str ..

self + other

Returns a new instance of the same class with the sum of the values.

If other is a temperature instance, it is first converted to the calling class, then the values are added. Otherwise, an attempt is made to add other to the value directly.

Returns
self.__add__(other)T

cls(self._value + other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value + other)

self - other

Returns a new instance of the same class with the subtraction of the values.

If other is a temperature instance, it is first converted to the calling class, then the values are subtracted. Otherwise, an attempt is made to subtract other to the value directly.

Returns
self.__sub__(other)T

cls(self._value - other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value - other)

self * other

Returns a new instance of the same class with the multiplication of the values.

If other is a temperature instance, it is first converted to the calling class, then the values are multiplicated. Otherwise, an attempt is made to multiplicate other to the value directly.

Returns
self.__mul__(other)T

cls(self._value * other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value * other)

self ** other

Returns a new instance of the same class with the exponentiation of the values.

If other is a temperature instance, it is first converted to the calling class, then the value is raised to the power of other. Otherwise, an attempt is made to raise the value field to the power of other.

Returns
self.__pow__(other)T

cls(self._value ** other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value ** other)

self / other

Returns a new instance of the same class with the division of the values.

If other is a temperature instance, it is first converted to the calling class, then the values are divided. Otherwise, an attempt is made to divide other to the value directly.

Returns
self.__truediv__(other)T

cls(self._value / other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value / other)

self // other

Returns a new instance of the same class with the floor division of the values.

If other is a temperature instance, it is first converted to the calling class, then the values are divided and rounded. Otherwise, an attempt is made to floor divide other to the value directly.

Returns
self.__floordiv__(other)T

cls(self._value // other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value // other)

self % other

Returns a new instance of the same class with the remainder from the division of the values.

If other is a temperature instance, it is first converted to the calling class, then the values are divided. Otherwise, an attempt is made to use modulo operation on other to the value directly.

Returns
self.__mod__(other)T

cls(self._value % other.convert_to(cls).value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

Notes

If other is not a temperature instance, atempts to return: cls(self._value % other)

self == other

Checks if the values in the objects are equal and then returns a boolean.

If other is a temperature instance, it is first converted to the calling class, then the objects are evaluated. That means: if other converted to the calling class has the same value, it returns True, otherwise it returns False.

Returns
self.__eq__(other)bool

self._value == other.convert_to(cls).value

rtype

bool ..

Notes

If other is not a temperature instance, atempts to return: self._value == other

self < other

Checks if the calling temperature object value is lesser than other and then returns a boolean.

If other is a temperature instance, it is first converted to the calling class, then the objects are evaluated. That means: if other converted to the calling class has a greater value, it returns True, otherwise it returns False.

Returns
self.__lt__(other)bool

self._value < other.convert_to(cls).value

rtype

bool ..

Notes

If other is not a temperature instance, atempts to return: self._value < other

self <= other

Checks if the calling temperature object value is lesser or equal than other and then returns a boolean.

If other is a temperature instance, it is first converted to the calling class, then the objects are evaluated. That means: if other converted to the calling class has a greater or equal value, it returns True, otherwise it returns False.

Returns
self.__le__(other)bool

self._value <= other.convert_to(cls).value

rtype

bool ..

Notes

If other is not a temperature instance, atempts to return: self._value <= other

self != other

Checks if the calling temperature object value is different from other and then returns a boolean.

If other is a temperature instance, it is first converted to the calling class, then the objects are evaluated. That means: if other converted to the calling class is different from other, it returns True, otherwise it returns False.

Returns
self.__ne__(other)bool

self._value != other.convert_to(cls).value

rtype

bool ..

Notes

If other is not a temperature instance, atempts to return: self._value != other

self > other

Checks if the calling temperature object value is greater than other and then returns a boolean.

If other is a temperature instance, it is first converted to the calling class, then the objects are evaluated. That means: if other converted to the calling class is greater than other, it returns True, otherwise it returns False.

Returns
self.__gt__(other)bool

self._value > other.convert_to(cls).value

rtype

bool ..

Notes

If other is not a temperature instance, atempts to return: self._value > other

self >= other

Checks if the calling temperature object value is greater or equal to other and then returns a boolean.

If other is a temperature instance, it is first converted to the calling class, then the objects are evaluated. That means: if other converted to the calling class is greater or equal to other, it returns True, otherwise it returns False.

Returns
self.__ge__(other)bool

self._value >= other.convert_to(cls).value

rtype

bool ..

Notes

If other is not a temperature instance, atempts to return: self._value >= other

divmod(self, other)

Returns a tuple of two new instances of the same class with the quotient and remainder.

If other is a temperature instance, it is first converted to the calling class, then the values are divided. Otherwise, an attempt is made to use divmod operation between the calling class and other to the value directly.

Returns
self.__divmod__(other)bool

return cls(result[0]), cls(result[1])

rtype

tuple[Any, Any] ..

Notes

If other is not a temperature instance, result is:

result = divmod(self._value, other)

If it is a temperature instance:

result = divmod(self._value, other.convert_to(cls).value)

round(self, ndigits=None)

Returns a new instance of the same class with value rounded.

Returns
self.__round__(other)T

cls(int(round(self._value, ndigits=ndigits)))

rtype

TypeVar(T, bound= AbstractTemperature) ..

math.floor(self)

Returns a new instance of the same class with the floor of value.

Returns
self.__floor__(other)T

cls(floor(self._value))

rtype

TypeVar(T, bound= AbstractTemperature) ..

math.ceil(self)

Returns a new instance of the same class with the ceiling of value.

Returns
self.__ceil__(other)T

cls(ceil(self._value))

rtype

TypeVar(T, bound= AbstractTemperature) ..

math.trunc(self)

Returns a new instance of the same class with the truncated integer part of value.

Returns
self.__trunc__(other)T

cls(trunc(self._value))

rtype

TypeVar(T, bound= AbstractTemperature) ..

float(self)

Returns a float of value.

Returns
_valuefloat

float(self._value)

rtype

float ..

int(self)

Returns an int of value.

Returns
_valueint

int(self._value)

rtype

int ..

abs(self)

Returns a new instance of the same class with the absolute of value.

Returns
self.__abs__()float

cls(abs(self._value))

rtype

AbstractTemperature ..

+self

Returns a new instance of the same class with +value.

Returns
self.__pos__()T

cls(+self._value)

rtype

AbstractTemperature ..

-self

Return a new instance of the same class with the negation of value.

Returns
self.__neg__()T

cls(-self._value)

rtype

AbstractTemperature ..

~self

Return a new instance of the same class with bitwise NOT of value.

Returns
self.__invert__()T

cls(-self._value - 1)

rtype

AbstractTemperature ..

__radd__(other)

Returns a new instance of the same class with the sum of the values.

An attempt is made to add the value to the other.

Returns
self.__radd__(other)T

cls(other + self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rsub__(other)

Returns a new instance of the same class with the subtraction of the values.

An attempt is made to subtract the value to the other.

Returns
self.__rsub__(other)T

cls(other - self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rmul__(other)

Returns a new instance of the same class with the multiplication of the values.

An attempt is made to multiply other by the value.

Returns
self.__rmul__(other)T

cls(other * self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rpow__(other)

Returns a new instance of the same class with the exponentiation of the values.

An attempt is made to raise other to the power of the value.

Returns
self.__rpow__(other)T

cls(other**self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rtruediv__(other)

Returns a new instance of the same class with the division of the values.

An attempt is made to divide the other by the value.

Returns
self.__rtruediv__(other)T

cls(other / self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rfloordiv__(other)

Returns a new instance of the same class with the floor division of the values.

An attempt is made to floor divide the value to other.

Returns
self.__rfloordiv__(other)T

cls(other // self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rmod__(other)

Returns a new instance of the same class with the remainder from the division of the values.

An attempt is made to apply modulo between other and value.

Returns
self.__rmod__(other)T

cls(other % self._value)

rtype

TypeVar(T, bound= AbstractTemperature) ..

__rdivmod__(other)

Returns a tuple of two new instances of the same class with the quotient and remainder.

An attempt is made to apply divmod between the calling class and the value.

Returns
self.__rdivmod__(other)T

cls(result[0]), cls(result[1])

rtype

tuple[Any, Any] ..

Notes

result is a tuple with the results of: divmod(other, self._value)

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

abstract convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

Temperature Classes

All temperature objects inherit a conversion to itself that when called it will always return the same object (and that’s why those methods aren’t included here in each class doc).

Note

The symbol property is read-only and different for each class.

class totemp.Celsius(value)

Bases: AbstractTemperature

Class to represent Celsius temperature scale.

Attributes
_symbolstr

Celsius official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Fahrenheit(value)

Bases: AbstractTemperature

Class to represent Fahrenheit temperature scale.

Attributes
_symbolstr

Fahrenheit official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Delisle(value)

Bases: AbstractTemperature

Class to represent Delisle temperature scale.

Attributes
_symbolstr

Delisle official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Kelvin(value)

Bases: AbstractTemperature

Class to represent Kelvin temperature scale.

Attributes
_symbolstr

Kelvin official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Newton(value)

Bases: AbstractTemperature

Class to represent Newton temperature scale.

Attributes
_symbolstr

Newton official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Rankine(value)

Bases: AbstractTemperature

Class to represent Rankine temperature scale.

Attributes
_symbolstr

Rankine official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Reaumur(value)

Bases: AbstractTemperature

Class to represent Réaumur temperature scale.

Attributes
_symbolstr

Réaumur official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_romer()

Returns a Rømer object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rømer)Rømer
rtype

Romer ..

class totemp.Romer(value)

Bases: AbstractTemperature

Class to represent Rømer temperature scale.

Attributes
_symbolstr

Rømer official scale symbol.

_valuefloat

Temperature value (e.g. 36 or -3.14).

property symbol: str

Returns official scale symbol (read-only).

Returns
_symbolstr

self._symbol

rtype

str ..

property value: float

Returns temperature object value.

Returns
_valuefloat

self._value

rtype

float ..

rounded()

Returns the temperature object with converted value to int (rounded).

Returns
__class__(int(round(self._value)))T
rtype

TypeVar(T, bound= AbstractTemperature) ..

to_celsius()

Returns a Celsius object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Celsius)Celsius
rtype

Celsius ..

to_fahrenheit()

Returns a Fahrenheit object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Fahrenheit)Fahrenheit
rtype

Fahrenheit ..

to_delisle()

Returns a Delisle object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Delisle)Delisle
rtype

Delisle ..

to_kelvin()

Returns a Kelvin object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Kelvin)Kelvin
rtype

Kelvin ..

to_newton()

Returns a Newton object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Newton)Newton
rtype

Newton ..

to_rankine()

Returns a Rankine object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Rankine)Rankine
rtype

Rankine ..

to_reaumur()

Returns a Réaumur object which contains the class attribute “value” with the result from the conversion typed the same as the attribute.

Returns
convert_to(Reaumur)Reaumur
rtype

Reaumur ..

convert_to(temp_cls)

Returns an instance of temp_cls containing the converted value.

If no conversion to temp_cls is possible, TypeError is raised.

Return type

TypeVar(T, bound= AbstractTemperature)