On 29Oct2019 21:37, Oz Tiram <oz.ti...@gmail.com> 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 <c...@cskk.id.au>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/TFZOWA6RNPCKHD36I64OKCHXXLU5HXKV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to