On 29Oct2019 21:37, Oz Tiram <[email protected]> wrote:
Quite a few tutorials show how to use namedtuple to gain memory saving
and speed, over the DictReader.
[...]
Python's own documentation has got a recipe in the collections modules[1]
Hence, I was wondering why not go the extra step and add a new class to the
CSV module NamedTupleReader?
This class would do a good service for Python's users, especially newcomers
who are still not aware of
modules like the collections module.
Just for some context:
It is often suggested that several things which are just documentation
examples in modules like collections or itertools get promoted to
presupplied functions/classes. It tends to fail. Personally I think at
least some of these would be a good thing. (Disclaimer: I am not a core
dev.)
The tricky bit is the bikeshedding: what nice-but-superfluous features
or corner cases should it support?
I'd be for such things provided they lent themselve to extension i.e.
"here's a basic implementation which is easily subclassable for extra
features".
The other thing is that there are probably examples of csv->namedtuple
scattered throughout pypi, users might just need to find them. I know
I've written such a thing for myself:
https://pypi.org/project/cs.csvutils/
I entirely agree this would be easier to find and use in the stdlib. And
mine is probably overfeatured and underclean for use in the stdlib.
Cheers,
Cameron Simpson <[email protected]>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/TFZOWA6RNPCKHD36I64OKCHXXLU5HXKV/
Code of Conduct: http://python.org/psf/codeofconduct/