- 1
- 2
- 3
>>>from itertools import chain, repeat
>>>tuple(chain(tuple(chain(*tuple(repeat(tuple(chain((6,), repeat(7,5), (8,))),5)))),repeat(9, 7),repeat(10, 7)))
(6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10)
guest 31.05.2012 23:05 # +2
С такими цифрами, небось и tuple(([6]+[7]*5+[8])*5 + [9]*7 + [10]*7) будет быстрее.
Zapix 01.06.2012 01:17 # +1
guest 01.06.2012 16:32 # +3