questions re: calendar module

o1bigtenor o1bigtenor at gmail.com
Sat Aug 1 20:42:09 EDT 2020


On Sat, Aug 1, 2020 at 7:24 PM o1bigtenor <o1bigtenor at gmail.com> wrote:
>
> On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list
> <python-list at python.org> wrote:
> >
> > On 01/08/2020 23:36, o1bigtenor wrote:
> > > On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list
> > > <python-list at python.org <mailto:python-list at python.org>> wrote:
> > >
> > >     On 31/07/2020 02:52, o1bigtenor wrote:
> > >      > I regularly work in planning through multiple years at once.
> > >      > This means that I like to have a lot of stuff available in a calendar
> > >      > function.
snip
> > Let's start with the disappointing information:-
> > - please read https://docs.python.org/3/library/calendar.html and the
> > *function's* help:
> >
> >  >>> help(cal.calendar)
> > Help on method formatyear in module calendar:
> > formatyear(theyear, w=2, l=1, c=6, m=3) method of calendar.TextCalendar
> > instance
> >      Returns a year's calendar as a multi-line string.
> >
> > The word "year" is singular, and the parameters are all to do with the
> > output-presentation. We can't even request 'the rest of the year from
> > August onwards'!
>
> It is very disappointing - - - -suggests that thinking outside the space of
> one year is somehow deprecated. Frustrated when what you do demands
> that you think in longer periods of time (and yet have to function within
> the week as well).
>
> >
> > There are other helper functions. Also, we are invited to sub-class.
>
> Hmmmmmm - - - will have to investigate that.

Doing some searching - - - - sub-class really doesn't have a lot of 'official'
info. Perhaps an information source might be pointed out?
> >
> > Might it be possible to generate multiple year (or month) groups, split
> > them by line, and then reassemble line-by-line to produce the width and
> > temporal length required?
>
> Likely work well if the months were considered as discrete blocks.
> Thinking that one could have something like
>

> It is very useful for me to have the week numbers included. Have
> learned some fascinating things (some months have 6 weeks in
> them!) and the joys of formating (grin!).
> >
> > What do you think?
>
> I was starting from what I understood (how to print 'a' year) working
> to get closer to what I could use. Ncal allows me to display a
> calendar except I'm restricted to a display only 3 months wide. More
> than one month is relatively easy to display from present but not
> from some other point. It would seem that the 80 column display
> still rules supreme - - - - - and that's on a 1920 pixel wide monitor.
>
> Thanks for the ideas and suggestions!
>                January 20xx                                  February 20xx
>       Su  Mo  Tu  We  Th  Fr  Sa             Su  Mo  Tu  We  Th  Fr  Sa
> 1                  1     2     3    4    5        5                                      1    2
> 2     6     7    8     9    10  11  12       6     3     4    5     6      7   8    9
> 3    13   14  15   16   17  18  19       7    10   11  12   13   14  15  16
> 4    20   21  22   23   24  25  26       8
> 5    27   28  29   30   31
>

Reading through more docs there is a possibility of using the 'format'
command. Would need to first come up with a way of describing the
months (with their attendant week numbers) and then describe a
formating system which would then enable a use of 'print' to achieve
the desired goal.

Is this perhaps a good way of doing this?

TIA


More information about the Python-list mailing list