question on the 'calendar' function

o1bigtenor o1bigtenor at gmail.com
Tue Nov 20 14:05:27 EST 2018


On Tue, Nov 20, 2018 at 12:09 PM Ben Finney <ben+python at benfinney.id.au> wrote:
>
> o1bigtenor <o1bigtenor at gmail.com> writes:
>
> > I am in the process of learning my first computer programming language
> > (unless g-code counts and then it is my second - - - grin). It
> > definitely is a big world out there.
>
> Welcome, and congratulations on starting with Python!
>
> > The calendar function has a lot of versatility and shows care in its
> > development.
>
> I assume we are here talking about the standard library ‘calendar’
> module <URL:https://docs.python.org/3/library/calendar.html>, and the
> function is ‘calendar.calendar’ to generate a whole year calendar
> <URL:https://docs.python.org/3/library/calendar.html#calendar.calendar>.

These are the documents that I was examining before I asked my question.
>
> > For planning I need to be able to easily look backward 6 months and
> > forward at least 12 and better 18 months and would prefer perhaps even
> > a total of 36 (and even 60 might be useful) months of calendar
> > available. It could be useful to see the longer time spans as weeks
> > rather than as days but seeing the larger time frames only as months
> > would enable the planning that I need to do.
>
> Have you looked through the rest of the documentation of that module?
> Does ‘calendar.monthcalendar’ come close to what you need
> <URL:https://docs.python.org/3/library/calendar.html#calendar.monthcalendar>?

No - - - the limit is still one year (of 12 months) and my minimum would be
18 months and preferably quite a bit more.
>
> > Do I need to (somehow and I have no idea how) extend the calendar
> > function?
>
> It's quite feasible you may get to that point, at which time you will
> want to learn about composing functions by calling other functions;
> eventually you will learn a different technique, of creating a class by
> inheriting from an existing class.

Hmmmmmmmmmm - - - this sounds like what I'm going to have to do.
let's see if I can find docs on this.
>
> But all that may be in the future! Try just using the existing functions
> from that library module and see how far that gets you.

The calendar function as it exists just quite spread its wings far enough
for my needs but this extension by inheritance is intriguing!

Thanks for the ideas.



More information about the Python-list mailing list