pyrecord icon indicating copy to clipboard operation
pyrecord copied to clipboard

Clarify difference between this and `namedtuple` on website

Open cool-RR opened this issue 11 years ago • 4 comments

cool-RR avatar Nov 16 '14 10:11 cool-RR

Hi @cool-RR!

I did it in the Best Practices page, but now that you point it out, I think I should link to that entry from the homepage.

I'll do it later today.

Thank you!

gnarea avatar Nov 16 '14 12:11 gnarea

Haven't really explained what are the advantages over namedtuple, and why an immutable record would be so superior to a namedtuple.

On Sun, Nov 16, 2014 at 2:07 PM, Gustavo Narea [email protected] wrote:

Hi @cool-RR https://github.com/cool-RR!

I did it in the Best Practices page https://pythonhosted.org/pyrecord/best-practices.html#use-the-right-data-type-for-the-job, but now that you point it out, I think I should link to that entry from the homepage.

I'll do it later today.

Thank you!

— Reply to this email directly or view it on GitHub https://github.com/gnarea/pyrecord/issues/4#issuecomment-63216852.

cool-RR avatar Nov 16 '14 12:11 cool-RR

Right, I see what you mean.

I agree about the advantages over namedtuple not being explicitly stated. I'll improve that later today.

I'll explain it in the documentation later, but basically, the advantages boil down to:

  • Type inheritance support.
  • Support for optional fields with default values.
  • In my opinion, a cleaner and more Pythonic API (adherence to PEP-8 and the Zen of Python).

By the way, I don't think records are better than named tuples because the former are mutable. I think there's a place for mutable and immutable records, and I'll be adding support for immutable records in the future (see #3).

gnarea avatar Nov 16 '14 12:11 gnarea

Hi!

Just to give you an update: I started this, but could not finish it over the weekend.

I'll update this ticket when it's done.

Cheers :)

gnarea avatar Nov 19 '14 13:11 gnarea