One of the things that has been on the ideas list for Phoenix since the
beginning is to not wrap the wx date and time classes, and just
automatically convert to/from Python's standard date and time classes
instead. The thought behind this is that it would remove the need to
convert to/from different datetime classes when needing to, for example,
do something like get a date from some wx widget and save it to a
database, thereby reducing complexity and confusion for the programmers.
If Python's classes had existed at the time that the calendar widget was
added to wx (this was the first thing that required the wxDateTime
class) then I probably would have just done a simple typemap at that
time and not wrapped wxDateTime at all. However after looking at it a
bit closer today I'm wondering if this is a good idea as there is not a
1:1 relationship between the available wx and python classes, and the
wxDateTime class seems much more comprehensive than Python's datetime.
While there is probably much more functionality there than almost
everybody will ever need to use, somebody somewhere probably is using it.
If I do wrap the wx classes then it will be easy to add a typemap to
automatically convert from datetime to wxDateTime when passing values to
wx methods. That will help reduce complexity a little, but may increase
confusion as any return values will still be instances of wxDateTime...
Thoughts?
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
To unsubscribe, send email to wxPython-dev+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-dev?hl=en
This seems like an opportunity to live out the ideal of "simple things should
be simple, complex things should be possible". The 95+% case is people just
need to get a Python DateTime into and out of some calendar control. The other
cases of needing access to the underlying wx.DateTime should be available via
the API, but not the default way to do things.
I'm sure I glossed over many messy details, but this seems like the general
direction.
Michael
IMO You should just drop the wxDateTime class. I should imagine
datetime is better tested (being more exposed to the wider world) than
wx.DateTime, and the zen of python covers this :
"There should be one-- and preferably only one --obvious way to do it."
If there is some extended functionality that you really can't do
without then we can provide it as a helper fns. e.g. in Ben's case :
(datetime, not_parsed_str) = wx.ParseDateTime(str)
Sam