Re: Subclassing tuple and introspection

2015-12-02 Thread Joseph L. Casale
> If you're not already familiar with collections.namedtuple, have a > look at it, as it sounds like just naming the fields may be all that > you need. You can also subclass it further to add methods if desired. Yeah, all the types in these collections are named tuples... The collection itself isn

Re: Subclassing tuple and introspection

2015-12-02 Thread Ian Kelly
On Wed, Dec 2, 2015 at 4:32 PM, Joseph L. Casale wrote: > I need to return a collection of various types, since python doesn't > have the terse facility of extension methods like C#, subclassing tuple > and adding a method seems like a terse way to accommodate this. If you're not already familiar

Subclassing tuple and introspection

2015-12-02 Thread Joseph L. Casale
I need to return a collection of various types, since python doesn't have the terse facility of extension methods like C#, subclassing tuple and adding a method seems like a terse way to accommodate this. However, if the method returns one element of the collection, how can one enable introspectio