calendar.py doesn't use lists???

Tim Peters tim.one at comcast.net
Mon Apr 22 18:57:15 EDT 2002


[Aaron Watters]
> Hi guys.  I got an irksome problem.  It's possible that
> it's fixed in python 2.2.1, but even if it is, it irks me.

It's fixed in 2.2.1.

> I tried the following script:
>
> """
> import sys
> print sys.version
> if 1:
>     from calendar import month_abbr, month_name
>     # hey python guys, i want lists!!
>     for x in (month_abbr, month_name):
>         print type(x)
>     month_abbr = list(month_abbr)
>     month_name = list(month_name)
>     print month_abbr
>     print month_name
> """

...

> Using Python 2.2 I get this
>
> """
> 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)]
> <type 'instance'>
> <type 'instance'>
> [CRASH AND BURN... WINDOWS XP SUGGESTS I SEND A COMPLAINT TO MICROSOFT...]

So do I!  Microsoft should get many more complaints than it does.  In 2.2.1
it's hard to say what it will print, because it's become locale-dependent.
On my 100% US English box, I get this in 2.2.1:

<type 'instance'>
<type 'instance'>
['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
     'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
['', 'January', 'February', 'March', 'April',
     'May', 'June', 'July', 'August',
     'September', 'October', 'November', 'December']

> ...
> WHO'S GOOFY IDEA WAS THIS?

As with most goofy ideas, I believe it started with a foreigner <wink>.

> Seriously, why did you need to change these sequences from
> lists where they worked with my code, to somethingsimilartolists
> that broke my code?

They wanted locale-dependent results, including when changing locale
dynamically.  OTOH, the variables you imported aren't documented, so you you
were on shaky ground importing them anyway.

> Irked.  In general I've noticed a tendancy with recent python
> releases towards changing stuff for the fun of changing stuff,
> I'm sorry to say.

You'll have to take that up with the person who wanted this badly enough to
submit the patch.

> Please remember that when you fix something that isn't broken, you
> might just be breaking somebody else's code.

Well, they thought getting back English names was broken.  I don't judge it,
I just fixed it <wink>.

> Sorry to whine.

na-it's-always-nice-to-hear-from-you!-ly y'rs  - tim






More information about the Python-list mailing list