On 18 Jun 2002, Martin v. Loewis wrote: > Brett Cannon <bac@OCF.Berkeley.EDU> writes: > > > Well, since locale info is not directly accessible for time-specific > > things in Python (let alone in C in a standard way), I have to do multiple > > calls to strftime to get the names of the weekdays. > > I wonder what the purpose of having a pure-Python implementation of > strptime is, if you have to rely on strftime. Is this for Windows only? > The purpose is that strptime is not common across all platforms. As it stands now, it requires that the underlying C library support it. Since it is not specified in ANSI C, not all have it. glibc has it so most UNIX installs have it. But Windows doesn't. It is not meant specifically for Windows, but it happens to be the major OS that lacks it. But strftime is guaranteed by Python to be there since it is in ANSI C. The reason I have the reliance on strftime is because it was the only way I could think of to reliably gain access to locale information in regards for time. If I didn't try to figure out what the names of months were, I would not need strftime at all. But since I wanted this to be able to be a drop-in replacement, I decided it was worth my time to figure out how to get this locale info when it is not directly accessible. As for why it is in Python and not C, it's mainly because I prefer Python. =) I think it could be done in C, but it would be much more work. I also remember Guido saying somewhere that he would like to see modules in Python when possible. It was possible, so I did it in Python. > Regards, > Martin > > -Brett C.
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