eta.util.general.gentemp
- gentemp(str)[source]
Generate a unique symbol that hasn’t been used before by appending an integer suffix i and then incrementing i.
- Parameters:
str (str) – String to use for symbol generation.
- Returns:
A “symbol” with a unique integer suffix attached to the given string.
- Return type:
Notes
This currently relies on an external symbol table stored in a file, which exploits the fact that race conditions with a shared file cannot occur with Python multiprocess (see: https://superfastpython.com/multiprocessing-race-condition-python/#Race_Condition_With_Shared_Data-2) However, this is somewhat clumsy/inefficient and should eventually be replaced by a proper solution.