Andrew Z <form...@gmail.com>: > I wonder what are the "best practises" for passing "time" parameters to > functions? > I noticed that sometimes i pass "time" as a str and then start "massaging" > it into delta or i need this time format or that format. Thats quite > annoying and inconsistent.
I do the same thing. It's not all that bad because the choice depends on the needs of the application. It's a slight bit annoying that I have to write parsing functions myself, but it's not all that bad: def parse_date(date): return datetime.date(*map(int, date.split("-"))) def parse_time(time): return datetime.time(*map(int, time.split(":"))) where "date" is expressed as "2017-10-14" and "time" [of day] as "19:39". Marko -- https://mail.python.org/mailman/listinfo/python-list