Function for fetching what months between two dates
Hello, Greetings! I have the following idea of adding a function in Lib/datetime.py which when called with the datetime.date object returns the months between the object datetime.date and the object datetime.date passed as the date_to argument in function. Herewith is the attached link to the commit: https://github.com/python/cpython/pull/23713/commits/2941fe88bd9c0c1a5c8ddd4... Kind regards,
Hi. Bundling this into the standard library doesn't seem to provide any real advantage over defining it as a free-standing utility function in your own code. And if it's in your own code you can easily tweak it if you need to :)
On Tue, Dec 15, 2020 at 03:08:51AM -0000, qaidjoharbarbhaya@gmail.com wrote:
Hello,
Greetings!
I have the following idea of adding a function in Lib/datetime.py which when called with the datetime.date object returns the months between the object datetime.date and the object datetime.date passed as the date_to argument in function.
What is this function used for? I see it returns a list of (year, month_number) tuples. Once I have collected those (year, month) tuples, what do I do with them? -- Steve
On Tue, 15 Dec 2020 at 15:32, Steven D'Aprano <steve@pearwood.info> wrote:
On Tue, Dec 15, 2020 at 03:08:51AM -0000, qaidjoharbarbhaya@gmail.com wrote:
Hello,
Greetings!
I have the following idea of adding a function in Lib/datetime.py which when called with the datetime.date object returns the months between the object datetime.date and the object datetime.date passed as the date_to argument in function.
What is this function used for?
I see it returns a list of (year, month_number) tuples. Once I have collected those (year, month) tuples, what do I do with them?
It will be more useful if the returned values are datetime.date objects. The library arrow has arrow.Arrow.range("month", startdate, enddate)
participants (4)
-
Marco Sulla
-
qaidjoharbarbhaya@gmail.com
-
Steven D'Aprano
-
Valentin Berlier