[Tutor] classes and names

Lloyd Kvam lkvam@venix.com
Sun, 23 Dec 2001 12:07:16 -0500


For date time processing you should probably look at mxDateTime.  It
is not part of the Python distribution.

http://www.lemburg.com/files/python/mxDateTime.html

It is VERY comprehensive.

Kevin McCormick wrote:

> Greetings all!  I am writing a module of spreadsheet type date functions 
> and I would like to do some things with the function names.   Some of 
> the functions are written really for supporting the actually useful 
> functions and I don't quite understand the __function__(arg), 
> __function(arg), and _function(arg) conventions. Also, it would be 
> useful to set the main date function as a class object, since my design 
> copies the time module and puts date information into a tuple.  I want 
> all this in the same file too, so I am asking for a lot. Lastly, an 
> exceptions class would be really useful.  I have read all the basic 
> tutorial stuff on classes, but what would be really cool is a simple 
> class that has this tuple and a way of being identified by my module 
> level functions.
> 
> What I think I want would be something like:
> 
> class datefuncExceptions:
>     # whatever goes into one of these type classes
>     # like invalid argument, function x choked on arg y, etc
> 
> class dateObject(date, arg2):
>     # call module functions to interpret date argument
> 
>     # attributes are tuple (y, m, d, serial, day)
> 
> def function(arg):
>     #
>     # val = __evaluate(arg)
>     #
>     # perform function tasks with val
>     #
>     # errors are datefuncExceptions
> 
> def __evaluate(arg):
>     # if arg is dateObject:
>           pass it back
>     # else:
>           decipher arg and resolve into dateObject
>     #
>     # return val
> 
> The idea is to understand many date formats as arguments and provide 
> functions like yearfrac, days360, workdays, daysbetween, weeksbetween, 
> eomonth, etc. at the module level so the class objects are small and two 
>  can easily be used as function arguments.
> 
> Thanks for any comments.
> Kevin
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582