Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80964
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-11-16 23:52 -0800 |
| References | <42b534f0-aeef-411f-80c5-db5d20c80b55@googlegroups.com> <mailman.15835.1416010397.18130.python-list@python.org> |
| Message-ID | <323fad4c-0a60-4b3e-9f08-fe3edc134424@googlegroups.com> (permalink) |
| Subject | Re: Array of Functions |
| From | Richard Riehle <rriehle@itu.edu> |
On Friday, November 14, 2014 4:13:28 PM UTC-8, Dennis Lee Bieber wrote: > On Fri, 14 Nov 2014 14:17:23 -0800 (PST), Richard Riehle <rriehle@itu.edu> > declaimed the following: > > >In C, C++, Ada, and functional languages, I can create an array of functions, albeit with the nastiness of pointers in the C family. For example, an array of functions where each function is an active button, or an array of functions that behave like formulae in a spreadsheet. I am finding this a bit challenging in Python. > > > >Example: > > > > r1c1 r1c2 r1c3 > > r2c1 r2c2 r2c3 > > r3c1 r3c2 r3c3 > > > > Personally (and tied to Windows) -- I'd likely load the win32 > extensions package and, since I do have M$ Office, programmatically create > that spreadsheet in a hidden Excel instance. > > Caveat: I've never actually done that... M$'s API has never felt > comfortable to me (I was spoiled by ARexx and applications with ARexx ports > on the Amiga). > > I don't know of any way to "magically" link your column three to using > arguments from the other two columns. Creating a table where each row is > two values and a function is no problem -- but I'd need to use external > code to run each row: > > results = [ f(x, y) for (x, y, f) in table] > > > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/ Thanks to everyone for their suggestions. I got this to work, and even created a very useful dictionary with it. Richard Riehle, PhD
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array of Functions Richard Riehle <rriehle@itu.edu> - 2014-11-14 14:17 -0800
Re: Array of Functions Marko Rauhamaa <marko@pacujo.net> - 2014-11-15 00:21 +0200
Re: Array of Functions Sam Raker <sam.raker@gmail.com> - 2014-11-14 14:44 -0800
Re: Array of Functions Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-14 15:50 -0700
Re: Array of Functions MRAB <python@mrabarnett.plus.com> - 2014-11-14 23:02 +0000
Re: Array of Functions Terry Reedy <tjreedy@udel.edu> - 2014-11-14 19:11 -0500
Re: Array of Functions Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-14 19:13 -0500
Re: Array of Functions Richard Riehle <rriehle@itu.edu> - 2014-11-16 23:52 -0800
Re: Array of Functions Anton <anschatten@gmail.com> - 2014-11-17 13:56 -0800
csiph-web