from random import randint
def randGen(aList):
while len(aList) > 0:
a=randint(0, len(aList) - 1)
# print '1111111111'
# print a
# print '1111111111'
# print '-------------'
# print len(aList)
# print '-------------'
yield aList.pop(a)
a=randGen([1,2,3,4,5])
print '##############'
for i in range(10):
if i==2:
print i
print a.next()
elif i==4:
print i
print a.next()
print '##############'
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/core/a14.py
##############
2
3
4
4
##############