- if isinstance(symbols, str):
- symbols = symbols.replace(',', ' ').split()
- else:
- symbols = list(symbols)
- for i, symbol in enumerate(symbols):
- if isinstance(symbol, Symbol):
- symbols[i] = symbol.name
- elif not isinstance(symbol, str):
- raise TypeError('symbols must be strings or Symbol instances')