gnarea/pyrecord

Clarify difference between this and `namedtuple` on website

Opened this issue · 4 comments

Clarify difference between this and `namedtuple` on website

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!

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 notifications@github.com
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
#4 (comment).

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).

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 :)