[Python-bugs-list] [ python-Bugs-485723 ] time.localtime() unsliceable!!

noreply@sourceforge.net noreply@sourceforge.net
Mon, 26 Nov 2001 10:47:29 -0800


Bugs item #485723, was opened at 2001-11-26 10:47
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485723&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: time.localtime() unsliceable!!

Initial Comment:
The result of time.localtime()[2:4]
(or any slice) will return a strange
result, to wit:
  (<nil>, <nil>)

Comparison of this slice to any other
value will cause Python to CORE.

For example:
   if time.localtime()[3:5] > (12, 00):
will CORE python.

This is version 2.2b1 on Linux.

The workaround I have used is to make
a shallow copy of the result of time.localtime().

That is, time.localtime()[:][2:4] works fine!

Also, single element indexing DOES seem to work.
It is just slicing that causes the problem.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=485723&group_id=5470