Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pyoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import numbers
import os
import sys
from string import ascii_uppercase

import uno

Expand Down Expand Up @@ -209,11 +210,11 @@ def _col_name(index):
'AA'

"""
for exp in itertools.count(1):
limit = 26 ** exp
if index < limit:
return ''.join(chr(ord('A') + index // (26 ** i) % 26) for i in range(exp-1, -1, -1))
index -= limit
buf = []
while index >= 0:
buf.append(ascii_uppercase[index % 26])
index = index // 26 - 1
return ''.join(buf[::-1])


@str_repr
Expand Down