I have a bunch of function like: def p2neufrage(_): """ create new element""" anfrage,ergebnis=getanfrage() if ergebnis.get("status","ok") == "ok": wert=anfrage["feld"] # do something # unique here
ergebnis["innerHTML"]=..... something .... # return simplejson.dumps(ergebnis, skipkeys=False, ensure_ascii=False, check_circular=True, allow_nan=True) so, everywhere there is the same beginning: anfrage,ergebnis=getanfrage() I analyze some transmitted jason-document; check for errors then I take the values out of the request, process it and fill the slots of a result ("ergebnis") dictionary, which is returned. So the beginning and the end of the function is allways repeated. It would be great to factor it out ... i startet with that ...getanfrage() call. Is there anything more possible? Thanks for any hint Harald -- http://mail.python.org/mailman/listinfo/python-list