Guido van Rossum wrote: >>>[Brett] >>> >>> >>>>>>I got a single email from someone asking me to change the >>>>>>functionality so that it would raise an exception if part of the >>>>>>input string was not parsed. >>>>> >>>[Guido van Rossum] >>> >>> >>>>>That sounds like a good idea on the face of it. Or will this break >>>>>existing code? >>> >>> >>>[Brett] >>> >>> >>>>Maybe. If they depend on some specific behavior on a platform that offers >>>>it, then yes, there could be issues. But since the docs are so vague if >>>>it does break code it will most likely be because someone didn't follow >>>>the warnings in the spec. >>> >>> >>>If you add some flag to control this behavior, defaulting to strict, >>>then at least people who rely on the old (non-strict) behavior can use >>>the flag rather than redesign their application. >>> >> >>But the problem is that I have no idea what the old behavior is. Since >>the spec is so vague and open I have no clue what all the various libc >>versions do. I have just been patching strptime the best I can to >>handle strange edge cases that pop up and work as people like Kevin need >>it to. > > > OK. Maybe I misunderstood (I've now got to admit that I've never > tried strptime myself). From your initial message (still quoted > above) I thought that it was a simple case of strptime parsing as much > as it could and then giving up (sort of like sscanf), and that the > suggestion you received was to make it insist on parsing everything or > fail. I still think that would be a clear improvement. But if the > original situation wasn't as clear-cut, maybe I should have stayed out > of this... > I wasn't clear enough. I already patched strptime to raise an error if there is anything left that was not parsed (my first CVS checkin actually); this functionality is already there. So I think we just talked ourselves in a circle. =) > >>Unless you are suggesting a flag that when set controls whether the >>Python version or a libc version if available is used, which I guess >>could work as a transition to get people to move over. Is this what you >>are getting at, Guido? And if it is, do you want it at the function or >>module level? I say function, but that is because it would be easier to >>code. =) > > > No, that's not what I was going for at all -- I think that would be a > mistake that woud just cause people to worry needlessly about which > strptime version they should use. > Well, now that I think we have the whole strict parsing cleared up, I assume we don't need this anymore. Is there any other worries? -Brett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4