2008/5/8 Tim Roberts <[EMAIL PROTECTED]>: > "Andrii V. Mishkovskyi" <[EMAIL PROTECTED]> wrote: > > >2008/5/7 Alexandr N Zamaraev <[EMAIL PROTECTED]>: > > >> Subj is bag? > >> > >> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit > >> (Intel)] on win32 > >> Type "help", "copyright", "credits" or "license" for more information. > >> >>> from datetime import datetime > >> >>> datetime.today().strftime('%Y_%m_%d %H_%M_%S.csv') > >> '2008_05_07 12_30_22.csv' > >> >>> datetime.today().strftime(u'%Y_%m_%d %H_%M_%S.csv') > >> Traceback (most recent call last): > >> File "<stdin>", line 1, in <module> > >> TypeError: strftime() argument 1 must be str, not unicode > > > > >Unicode and str objects are not the same. Why do you think that this > >is a bug? > > I think that's a perfectly reasonable thing to expect. At the risk of > over-generalization, there is no good reason why, by this point in time, > all of the standard library routines that accept strings shouldn't also > accept Unicode strings. > > It's the duck typing principle. Unicode strings look, walk, and talk like > regular strings. An error like this is not intuitive.
On a second thought -- both of you (you and Alexander) are right. I changed mind and posted a bug on Roundup already (bug #2782). > -- > Tim Roberts, [EMAIL PROTECTED] > Providenza & Boekelheide, Inc. > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Wbr, Andrii Mishkovskyi. He's got a heart of a little child, and he keeps it in a jar on his desk. -- http://mail.python.org/mailman/listinfo/python-list