Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Computed attribute names

Reply
Thread Tools

Computed attribute names

 
 
Dale Amon
Guest
Posts: n/a
 
      04-08-2009
There are a number of things which I have been used
to doing in other OO languages which I have not yet
figured out how to do in Python, the most important
of which is passing method names as args and inserting
them into method calls. Here are two cases I have been
trying to figure out for a current project.

The first is passing methods to dispatcher methods. In
pseudocode, something like this:

def dispatcher(self,methodname):
self.obj1.methodname()
self.obj2.methodname()

and another case is selecting behavior of an object by
setting a type string, with pseudo code like this:

self.IBM029 = re.compile([^acharset]
self.IBM026 = re.compile([^anothercharset]
self.type = "IBM029"
errs = self.(self.type).findall(aCardImage)

I have yet to find any way to do either, although it appears
I could do some of it using a long and roundabout call string
using __dict__.

What is the Python dialect for this sort of runtime OO?




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJ3PFRZHES7UL0zXERAiXAAJ0UZyD3589G9hTL/N9A0ect1steAgCaApWJ
HKVHFl3zCrZgSsJEtLU/VJ4=
=B//P
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
 
Peter Pearson
Guest
Posts: n/a
 
      04-10-2009
On Wed, 8 Apr 2009 19:47:46 +0100, Dale Amon <(E-Mail Removed)> wrote:
[snip]
> self.IBM029 = re.compile([^acharset]
> self.IBM026 = re.compile([^anothercharset]


Whoa! Thanks for the trip down memory lane. And a cheery
IEFBR14 to you, too.

--
To email me, substitute nowhere->spamcop, invalid->net.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Computed field in temp table causes error in .NET John Dalberg ASP .Net 1 02-03-2006 12:14 AM
How is Object.hashCode() computed? Aryeh.Friedman@gmail.com Java 2 05-24-2005 02:16 AM
Content-type: multipart/form-data - how is boundary computed Pascal Steiss HTML 1 03-19-2005 10:00 AM
Computed columns in datagrid Raymond Du ASP .Net 3 12-02-2004 05:32 AM
Matching attribute names to element names in a different path Carl XML 0 04-01-2004 01:15 PM



Advertisments