On 9/13/13 6:50 AM, Ricardo Aráoz wrote: > Simple is beautiful. Agree! > I do it this way : > > for field in self.DataStructure: > alias = field[0] > tabla = field[3] > campo = field[4] > if tabla: > self.addField('{}.{}'.format(tabla, campo), alias) > > If you'd like to go the 'table.field as alias' way, then replace the last > line with > "self.addField('{}.{} as {}'.format(tabla, campo, alias))". > > If you want to indent just do "self.addField('{}.{} as {}'.format(tabla, > campo, > alias).rjust(40))". > > If you want finer indenting (first line is just before the loop) : > > totLen = max((len('{}.{}'.format(i[3], i[4])) for i in self.DataStructure)) > ... > .. > . > self.addField('{}.{} as {}'.format(tabla, campo, alias).rjust(totLen))
Great, thanks! My code was basically unchanged since before .format() and list comprehensions (or maybe list comprehensions were there but I didn't know about them yet). Actually, I believe this goes back to early 2004, before dabo had DataStructure but I was using my own internal datastructure-like construct. Paul _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/523345a5.3050...@ulmcnett.com