From 237b881beb2e8378387e890256453f4b424fd4d4 Mon Sep 17 00:00:00 2001 From: Ramon Torres Date: Fri, 8 Mar 2024 19:25:19 -0500 Subject: [PATCH] Use __slots__ to optimize memory usage (#10) * Use `__slots__` to optimize memory usage * Version bump --- CHANGELOG.md | 6 ++++++ mp_yearmonth/yearmonth.py | 2 ++ pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70c1c87..cad8eb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## v0.3.1 + +### Changed + +- Use `__slots__` to optimize memory usage. + ## v0.3.0 ### Added diff --git a/mp_yearmonth/yearmonth.py b/mp_yearmonth/yearmonth.py index b24ac22..cd2c3c0 100644 --- a/mp_yearmonth/yearmonth.py +++ b/mp_yearmonth/yearmonth.py @@ -41,6 +41,8 @@ class YearMonth: month (int) : The month. """ + __slots__ = ("year", "month") + def __init__(self, year: int, month: int): """Create a new YearMonth object. diff --git a/pyproject.toml b/pyproject.toml index 2b236e0..1500082 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mp-yearmonth" -version = "0.3.0" +version = "0.3.1" description = "A year-month datatype for Python." keywords = ["year", "month", "date", "calendar"] authors = ["Ramon Torres "]