I'm working on a Python project where I'm handling dates, and I'd like to understand how to properly document functions or methods that accept and return date objects using datetime.date or date from the datetime library.
Specifically, I'm looking to understand how to document this correctly in the context of parameter typing and function/method return. Here are some examples of what I'm trying to achieve:we have two types of import:
from datetime import datetimeor
from datetime import datehow it works?
from datetime import datetimedef fuu(new_date: datetime.date)or
from datetime import datedef baa(new_date: date)and
def fuu(...) -> datetime.date:or
ou baa(...) -> date:My doubt is as follows: If the object that should be passed or returned is an object of type date. then should I usefrom datetime import datedef foo(new_date: date):to indicate that it is an object of type date or instead usefrom datetime import datetimedef baa(new_date: datetime)This is my doubt, since neither of the 2 start with a capital letter, as is conventional for a class. Which of the two is better to represent an object of type date? Especially one returned from pyodbc. its a date object or a datetime object??