[issue23884] New DateType for argparse (like FileType but for dates)

paul j3 report at bugs.python.org
Wed Apr 8 00:19:30 CEST 2015


paul j3 added the comment:

It's a possible addition, but I don't have sense of the demand for it.

I wonder, what does the class offer that a function like this doesn't?

    def adate(date_string):
        return datetime.datetime.strptime(date_string,'%Y-%m-%d').date()

I'd be hesitant to add FileType if wasn't already present.  It hasn't aged very well.  We've had bug issues related to v3 binary files, and contexts.   The main feature that FileType (beyond verifying that the file actually does exist) adds is the recognition of '-' as stdin/out.  

By analogy I'm lukewarm about adding a DateType class.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23884>
_______________________________________


More information about the Python-bugs-list mailing list