[Tutor] Speed of accessing list components

Dragonfirebane at aol.com Dragonfirebane at aol.com
Sat Jun 26 18:36:09 EDT 2004


In a message dated 6/26/2004 11:24:37 AM Eastern Standard Time, 
bgailer at alum.rpi.edu writes:
Only for the special case where the list consists of consecutive integers 
starting with 1.
My apologies. You are, of course, correct. However, I also suggested a 
solution that would work on strings, etc.:

>>> i = 0
>>> for x in string.ascii_letters:
        i -= 1
        print string.ascii_letters[i]

Z
Y
X
W
V
U
T
S
R
Q
P
O
N
M
L
K
J
I
H
G
F
E
D
C
B
A
z
y
x
w
v
u
t
s
r
q
p
o
n
m
l
k
j
i
h
g
f
e
d
c
b
a

Email: dragonfirebane at aol.com
AIM: singingxduck
Programming Python for the fun of it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040626/7acdf712/attachment.html


More information about the Tutor mailing list