Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99922 > unrolled thread
| Started by | "Joseph L. Casale" <jcasale@activenetwerx.com> |
|---|---|
| First post | 2015-12-02 23:55 +0000 |
| Last post | 2015-12-02 23:55 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Subclassing tuple and introspection "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-12-02 23:55 +0000
| From | "Joseph L. Casale" <jcasale@activenetwerx.com> |
|---|---|
| Date | 2015-12-02 23:55 +0000 |
| Subject | Re: Subclassing tuple and introspection |
| Message-ID | <mailman.151.1449100520.14615.python-list@python.org> |
> 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't applicable, think of a simple list/tuple. > I think that's going to depend heavily on the specific IDE being used, > but for general usage you might consider using PEP 484 type > annotations; I know that at least PyCharm supports their use for type > hinting. The guys here use PyCharm, where it becomes less than describable is I have to make a distinct instance of the subclass for each use by each namedtuple instance and generate doc strings that return those types for the helper methods. This is auto XSLT auto generated code, so I am not worried about the overhead maintaining it, I just didn't want to have to do that if there was a way to prime the type hinting by "properly" subclassing tuple for example. Thanks for the feedback. jlc
Back to top | Article view | comp.lang.python
csiph-web