[Python-ideas] date.datetime() method to convert from date to datetime
Ben Finney
ben+python at benfinney.id.au
Sat Jun 4 02:08:32 CEST 2011
Alexander Belopolsky
<alexander.belopolsky at gmail.com> writes:
> My preferred alternative to this idea would be to allow datetime
> constructor to take date (or datetime). This would make date/datetime
> behave similar to int/float.
+1. They are conceptually very similar types, so it makes sense for the
constructor to accept each of them.
> If this is done, I would also like the single-argument constructor to
> accept str in ISO format.
−1, please don't overload a type's default constructor to the point of
accepting all sorts of unrelated types.
I think ‘datetime.fromstring’, if implemented, should be a separate
alternative constructor (by whatever spelling).
--
\ “I knew it was a shocking thing to say, but … no-one has the |
`\ right to spend their life without being offended.” —Philip |
_o__) Pullman, 2010-03-28 |
Ben Finney
More information about the Python-ideas
mailing list