from calendar import* doesn't import everything

Rotwang sg552 at hotmail.co.uk
Wed Apr 25 17:25:33 EDT 2012


On 25/04/2012 01:26, Kiuhnm wrote:
> [...]
>
> Let's see... at line 561 of calendar.py there's something suspicious:
>
> --->
> # Support for old module level interface
> c = TextCalendar()
>
> firstweekday = c.getfirstweekday
>
> def setfirstweekday(firstweekday):
> try:
> firstweekday.__index__
> except AttributeError:
> raise IllegalWeekdayError(firstweekday)
> if not MONDAY <= firstweekday <= SUNDAY:
> raise IllegalWeekdayError(firstweekday)
> c.firstweekday = firstweekday
>
> monthcalendar = c.monthdayscalendar
> prweek = c.prweek
> week = c.formatweek
> weekheader = c.formatweekheader
> prmonth = c.prmonth
> month = c.formatmonth
> calendar = c.formatyear
> prcal = c.pryear
> <---
>
> So, it seems that "from calendar import *" is reserved for the "old
> interface" (i.e. non-OO).

Thanks, and likewise to Justin.


-- 
Hate music? Then you'll hate this:

http://tinyurl.com/psymix



More information about the Python-list mailing list