And I thought I might get away without using dicts... Thanks, Greg
Greg Graham schrieb: > Paul, > > Python does not allow mixing variable length arguments and keyword arguments > in that way. To accomplish what you want, you must add an argument preceded > by a "**" which will be a dict containing all of the keyword arguments as > key, value pairs. You then have to retrieve the arguments from the dict by > name. When called, the keyword arguments must be last. > > Here is a little example: > > def test(*column_definitions, **options): > print "Column Definitions:" + ", ".join(column_definitions) > output_csv_filename = options.get('output_csv_filename', None) > print "Output csv filename: " + str(output_csv_filename) > > >>>> test("kundennummer", "anrede", "vorname", "nachname", "plz", "ort", >>>> "adresse", "kontoinhaber", "blz", "kto", "bankname", "status", >>>> "spielbeginn", "letzte_aenderung", "importdatum", "briefdatum", >>>> "buchungsdatum", "stornodatum", output_csv_filename=None) > Column Definitions:kundennummer, anrede, vorname, nachname, plz, ort, > adresse, kontoinhaber, blz, kto, bankname, status, spielbeginn, > letzte_aenderung, importdatum, briefdatum, buchungsdatum, stornodatum > Output csv filename: None > > Greg _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor