Можно ли получить исходное имя переменной переменной, переданной функции? Например.
foobar = "foo"
def func(var):
print var.origname
Итак, чтобы:
func(foobar)
Возврат:
>>foobar
EDIT:
Все, что я пытался сделать, это сделать такую функцию, как:
def log(soup):
f = open(varname+'.html', 'w')
print >>f, soup.prettify()
f.close()
.. и функция сгенерирует имя файла из имени переданной ему переменной.
Я полагаю, что если это невозможно, мне просто нужно будет каждый раз передавать переменную и имя переменной в виде строки.