newname.py 211 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12

from time import time

_counter = 0

def newname(prefix):
    global _counter;
    _counter += 1
    ident = id(locals())
    nonce = int(time() * 1000) + _counter
    return "%s%x%x" % (prefix, ident, nonce)