3 ms·
There's a certain amount of that in my CSV library as well, which is strongly influenced by Python's standard library `csv` behavior. Example: extern crate
by burntsushi 9y ago
There's a certain amount of that in my CSV library as well, which is strongly influenced by Python's standard library `csv` behavior. Example:
extern crate csv;
fn main() {
let mut rdr = csv::ReaderBuilder::new()
.has_headers(false)
.from_reader("abc,foo\"baz,xyz".as_bytes());
println!("{:?}", rdr.records().collect::<Result<Vec<_>, _>>().unwrap());
}
Output:
[StringRecord(["abc", "foo\"baz", "xyz"])]
Python:
>>> import csv
>>> list(csv.reader(['abc,foo"baz,xyz']))
[['abc', 'foo"baz', 'xyz']]
This is what's meant by "prefer a parse over returning an error." I would say that this is the liberal philosophy rather than conservative, though.