![]() |
|
|
|||||||
![]() |
Python - Re: How best to test functions which use date.today |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Christian Heimes <> wrote:
> Lie Ryan wrote: > >> But this fails with: > >> > >> TypeError: can't set attributes of built-in/extension type > >> 'datetime.date' > > > > This is because today is an attribute. In python, we can override > > attribute access to become a function call. I don't have python right > > now, but try this: > > > > del date.today > > date.today = mytoday > > It won't work. The datetime module is written in C. You can't modify a C > extension. Hmm. Given that, Lie, maybe what you need to do is modify your code so that you call your own special purpose function to get 'today', and replace _that_ for testing, using datetime's today for production. --RDM rdmurray@bitdance.com |
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Give you enough string functions in Java web reporting tool | freezea | Software | 0 | 10-08-2009 09:03 AM |
| Please explain this virtual functions matter (c++) | smokey1401 | General Help Related Topics | 0 | 07-11-2008 11:53 PM |
| c# dynamic functions threading | Ahmad | MCTS | 0 | 07-10-2008 02:12 PM |
| piece-wise functions in Tex/HTML | lou | General Help Related Topics | 0 | 10-07-2006 03:08 AM |
| programming xxd3033 pioneer remote for universal functions | jmaroon | DVD Video | 0 | 08-27-2006 03:32 PM |