Converging Multiple Classes

George Silva georger.silva at
Fri Feb 4 11:54:20 EST 2011

Take a look at the strategy pattern. But with python being a dinamic
language, you probably won't need to implement it like that.


# import all you need
CAMERAS = ['A','B','C']
def capture_A:

def capture_B:

def capture_C:
def capture(camera):
 if camera in CAMERAS:
  if camera = 'A':
   function = capture_A

  if camera = 'B':
   function = capture_B

  if camera = 'C':
   function = capture_C

  # call function

On Fri, Feb 4, 2011 at 2:39 PM, Wanderer <wanderer at> wrote:

> I have a bunch of cameras I want to run tests on. They each have
> different drivers and interfaces. What I want to do is create python
> wrappers so that they all have a common interface and can be called by
> the same python test bench program. I'm not sure what to call it. I
> don't think it's inheritance. Maybe there is no official thing here
> and I just need to brute force my way through it. Is there some
> programming methodology I should be using?
> Thanks
> --

George R. C. Silva

Desenvolvimento em GIS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list