Alexander Belopolsky added the comment: It is not as mush about avoiding a one-liner as it is about duck-typing. IMO, dates and datetime objects are numbers in disguise. Many functions that are nominally numeric, can work with date/datetime/timedelta objects without modification. The fact that date/datetime do not accept their own instances often results in the need to branch on isinstance() or write a separate set of functions depending on whether dates are represented by numbers or by date instances.
The example that I gave is one of many and the fact that you suggested using isinstance() in the solution is telling. My ideal design would be for date/datetime constructors to take one argument that can be a string, a 3+ elements iterable, or any object that has a .timetuple() method. The varargs variants can of course stay as syntactic sugar. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22058> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com