[Python-bugs-list] [ python-Bugs-491301 ] a bad tuple comparison
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 10 Dec 2001 13:21:55 -0800
Bugs item #491301, was opened at 2001-12-10 12:48
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=491301&group_id=5470
Category: None
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Daniel Ortmann (dortmann)
Assigned to: Nobody/Anonymous (nobody)
Summary: a bad tuple comparison
Initial Comment:
A slice of sys.version_info does not compare as a tuple.
#!/usr/local/bin/python
import sys
a = (2,2)
b = (sys.version_info[0:1])
c = (sys.version_info[0], sys.version_info[1])
assert a == b, "kaBOOM! assertion failed: a == b"
assert a == c, "kaBOOM! assertion failed: a == c"
print "everything is okey dokey! :-)"
Comment out the first assert and everything works fine.
(I am new to python, but this seems to be an error; it
was, at the very least, unexpected and counter intuitive.)
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-12-10 13:21
Message:
Logged In: YES
user_id=31435
Not a bug. Review the docs on sequence slicing: s[i:j]
contains j-i elements, not j-i+1. Try printing sys.version
[0:1], then try printing sys.version[:2]. Repeat until the
light bulb goes off <wink>.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=491301&group_id=5470