comparing dialects of csv-module
Malte Dik
malte.usenet at web.de
Sat Dec 19 10:12:22 EST 2009
quote:
> An implementation for the lazy
>
>>>> import csv
>>>> d = csv.Sniffer().sniff("1,2,3")
>>>> def eq(a, b, attributes=[name for name in dir(d) if not
> name.startswith("_")]):
> ... return all(getattr(a, n, None) == getattr(b, n, None) for n in
> attributes)
> ...
Wow, this is awesome. I'd never come up with something like this.
Will digg into it deeper as I implement it (code snippets like this need to
melt in order to effuse all their flavor ;), but want to thank you very much
in the first place! :)
Have a nice day everyone,
Malte
More information about the Python-list
mailing list