Month
A calendar month.
The twelve months are class fields, Month.JANUARY through Month.DECEMBER,
and are also indexable by number: Month[1] through Month[12]. There is no
constructor; the twelve values are the only instances.
Example
Class Methods
(index) number -> Month
Returns the month with the given number.
Parameters
| Name | Type | Description |
|---|---|---|
number |
Int |
Month number, 1 through 12. |
Errors
| Exception | Condition |
|---|---|
ValueError |
The number is not 1 through 12 |
Example
Methods
(eq) other
Compares two months.
(hash)()
Hashes the value.
(lt) other
Orders two months, in calendar order.
(str)()
Returns the uppercase English name, such as JANUARY.
next() -> Month
Returns the following month, wrapping from December to January.
previous() -> Month
Returns the preceding month, wrapping from January to December.