<div dir="ltr"><br>On Thu, Aug 27, 2015 at 8:13 AM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>[Alexander Belopolsky]<br>>><br>>><br>>> OK, so datetime module itself will never set fold=-1.   In the list below, can you mark the methods that need to be patched to check the fold attribute in your preferred design:<br><br>[Ethan Furman]<br>datetime.__new__         YES<br>datetime.combine         YES (could have a time instance with fold=None)<br>datetime.replace         YES<br>datetime.strptime        only if `fold=` is allowed<br><br>[Ethan Furman]<br>><br>> If `fold=None` is present /when attempting to create a datetime/ that is ambiguous or invalid, an exception is raised /at that moment/ meaning that a datetime with `fold=None` /will never exist/. fold=None` /will not be the default/.<br><br>I don't grasp the significance of the slashes in your text above, but it looks like your idea is similar to the one I outlined in the "Strict Invalid Time Checking: an idea for another PEP" thread.<br><br>As I said there, it is workable, but there are many details that need to be thought out before this idea becomes PEP-worthy.  Let's move the discussion of those details to a thread that does not have PEP 495 in the subject.  Feel free to reuse my thread or open a new one.<br><br>What we can do in PEP 495 is tighten the language about acceptable values for the fold= argument in replace().  Since pure python implementation currently allows None for year through microsecond arguments, we have the following text in the PEP:<br><br>"""<br> In CPython, any non-integer value of fold [passed to replace()] will raise a TypeError , but other implementations may allow the value None to behave the same as when fold is not given.<div>"""</div><div><br></div><div>I am fine with removing this text and leaving fold=None option open for the future PEPs to explore.</div></div>