Skip to content

Commit a6473a6

Browse files
committed
Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns 'time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags
1 parent 1c72533 commit a6473a6

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lib/test/test_structseq.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def test_tuple(self):
2828

2929
def test_repr(self):
3030
t = time.gmtime()
31-
repr(t)
31+
self.assert_(repr(t))
32+
t = time.gmtime(0)
33+
self.assertEqual(repr(t),
34+
"time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, "
35+
"tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)")
3236

3337
def test_concat(self):
3438
t1 = time.gmtime()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
1212
Core and builtins
1313
-----------------
1414

15+
- Object/structseq.c: Implemented new structseq representation. structseqs
16+
like the return value of os.stat are more readable.
17+
1518
- Patch #1700288: added a type attribute cache that caches method accesses,
1619
resulting in speedups in heavily object-oriented code.
1720

0 commit comments

Comments
 (0)