On Tue, Apr 12, 2016 at 8:57 AM, Sven R. Kunze <srku...@mail.de> wrote:
> As an example: time.sleep takes a number of seconds (notice the primitive > datatype just like a string) and does not take timedelta. > > Why don't we add datetime.timedelta support to time.sleep? Very same thing. yup -- and it there were a lot of commonly used APIs that took strings, and multiple timedelta implementations, then it would make sense to introduce a __seconds_int__ protocol. I don't think the use-cases rise to that level, myself. Though if someone wanted to put a call in to obj.totalseconds() into time.sleep, that might actually be worth it :-) (now that yo mention it -- I have a substantial library that uses seconds internally, and currently has an ugly sometimes integer seconds, sometimes timedelta API -- maybe I'll introduce that protocol. Not sure why I didn't think of that before now. Because I'm passing it to modfoo.dosomethingwithafile() which takes a >> filename and passes it to shutils, which passes it to builtin open, >> which passes it to os.open. >> >> Should Path grow a dosomethingwithmodfoo method? > > It can't -- modfoo could be a third-party module -- it is impossible for Path to grow everything that any third party module might support. -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com