From: Douglas S. B. <db...@cs...> - 2008-02-20 15:04:22
|
Gary Burton wrote: > Benny, > > >Furthermore, the idea of Config.get("date-about-range") instead of > >Config.get(Config.DATE_ABOUT_RANGE) would fit with what pygtk does for > eg events or get_property, >I see no problems with that. > > The advantage of using Config.get(Config.DATE_ABOUT_RANGE) is that you > should discover syntax errors much sooner - i.e. when you run the > application and the python byte compiler tries to produce a .pyc file. > This, of course assumes that my understanding of what the python > compiler does is correct! It's certainly what would happen in a compiled > language like java. > If you have Config.get("date_about_range"), with underscores instead of > hyphens embedded in a piece of code, you won't discover that it's wrong > until you execute that line of code because it's syntactically correct > as far as the python compiler is concerned. What would happen then would > depend on how the get method is coded. As a very broad statement, I think most Python programmers have substituted testing for compile-type checks. Python does have compile-type checks, and as you say, moving from Date.DATE_ABOUT_RANGE to any kind of string representation will lose those checks. But, it makes the code easier for the human to write (and read, I think). I'm a big fan of writing a set of unit-tests at, or even before, you write the code. "The code ain't done till the unit test's run" :) -Doug > Bye > > Gary |