Read data from CSV file and transform from string to correct data-type, including a list-of-integer column

As the docs explain, the CSV reader doesn’t perform automatic data conversion. You have the QUOTE_NONNUMERIC format option, but that would only convert all non-quoted fields into floats. This is a very similar behaviour to other csv readers. I don’t believe Python’s csv module would be of any help for this case at all. As … Read more

How to decorate a class?

Apart from the question whether class decorators are the right solution to your problem: In Python 2.6 and higher, there are class decorators with the @-syntax, so you can write: @addID class Foo: pass In older versions, you can do it another way: class Foo: pass Foo = addID(Foo) Note however that this works the … Read more