Skip to content

DOC: Add composition example to internals.rst #9984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Apr 25, 2015

Follow-up of #9802. Added an example of composition to internal.rst.

Also, fixed broken section name for subclass document.

@sinhrks sinhrks added the Docs label Apr 25, 2015
@sinhrks sinhrks added this to the 0.16.1 milestone Apr 25, 2015
Define Original Data Structures using pandas
--------------------------------------------

.. warning:: If you simply want to add some functionalities to ``pandas``, the easiest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "functionality" not "functionalities (here and next paragraph)


This section describes how to define your original data structure which extends ``pandas`` functionality using `composition <http://en.wikipedia.org/wiki/Composition_over_inheritance>`_.

Below example shows an original class which is mostly compatible with ``Series``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below example -> The example below

@shoyer
Copy link
Member

shoyer commented Apr 26, 2015

I made a few grammar/language suggestions.

But actually, I'm not sure this example makes the best case for why composition is usually a better idea than subclassing. Using __getattr__ makes this ComposedSeries example a sort of limited version of subclassing.

So many we should show an example of how subclassing can lead to unexpected behavior or a more realistic version of composition that simply makes use of a series or frame to hold internal state.

@jreback jreback modified the milestones: 0.17.0, 0.16.1 May 6, 2015
@sinhrks sinhrks force-pushed the doc_composition branch from 3cf2c13 to e85c550 Compare June 6, 2015 01:09
@jreback
Copy link
Contributor

jreback commented Jul 28, 2015

status?

@jreback
Copy link
Contributor

jreback commented Aug 18, 2015

@sinhrks going to move this to next version.

@jreback jreback modified the milestones: Next Major Release, 0.17.0 Aug 18, 2015
@jreback
Copy link
Contributor

jreback commented Oct 11, 2015

@sinhrks can you update

@jreback
Copy link
Contributor

jreback commented Nov 18, 2015

closing, but if you'd like to update, pls reopen

@jreback jreback closed this Nov 18, 2015
@sinhrks sinhrks deleted the doc_composition branch February 27, 2016 05:39
@jorisvandenbossche jorisvandenbossche modified the milestones: No action, Next Major Release Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants