Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32639
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.octanews.net!indigo.octanews.net!auth.brown.octanews.com.POSTED!not-for-mail |
|---|---|
| From | Paul Rubin <no.email@nospam.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Organisation of python classes and their methods |
| References | <B16BD7AC-F860-4A30-A08D-A0235CC25F20@mac.com> <k6vuis$j5b$1@ger.gmane.org> <mailman.3181.1351844460.27098.python-list@python.org> |
| Date | Fri, 02 Nov 2012 10:24:56 -0700 |
| Message-ID | <7xhap7dijb.fsf@ruckus.brouhaha.com> (permalink) |
| Organization | Nightsong/Fort GNOX |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:5DoYtXPoas24N4qdrotD5XTWwJ8= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Lines | 17 |
| NNTP-Posting-Date | 02 Nov 2012 12:24:56 CDT |
| X-Complaints-To | abuse@octanews.net |
| Xref | csiph.com comp.lang.python:32639 |
Show key headers only | View raw
Martin Hewitson <martinhewitson@mac.com> writes: > Well, here we disagree. Suppose I have a class which encapsulates > time-series data. Below is a list of the absolute minimum methods one > would have to process that data. ... > 'abs' > 'acos' > 'asin' > ... Ok, THERE is your problem. Why do you have separate implementations of all those functions? Does the abs of a time series simply mean the abs of each element of the series? In that case you want just ONE method, something like "map", which applies an arbitrary function to all elements of the series. Then for time series ts, instead of saying ts.abs(), you'd say ts.map(abs) where abs is the existing, built-in absolute value function. You could similarly say ts.map(acos) etc. That gets rid of almost all of those methods.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Organisation of python classes and their methods Martin Hewitson <martinhewitson@mac.com> - 2012-11-02 09:20 +0100
Re: Organisation of python classes and their methods Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-02 11:49 +0100
Re: Organisation of python classes and their methods Martin Hewitson <martinhewitson@mac.com> - 2012-11-02 15:47 +0100
Re: Organisation of python classes and their methods Paul Rubin <no.email@nospam.invalid> - 2012-11-02 10:24 -0700
Re: Organisation of python classes and their methods Martin Hewitson <martinhewitson@mac.com> - 2012-11-02 18:40 +0100
Re: Organisation of python classes and their methods Paul Rubin <no.email@nospam.invalid> - 2012-11-02 11:29 -0700
csiph-web