accessing object attribute as parameter

ajikoe at ajikoe at
Sun Jun 26 12:43:57 CEST 2005


I would like to access object parameter / variable from a function.

For example :
class A:
  def __init__(self, x,y):
    self.x = x
    self.y = y

in the main program, I have a list of obj A:
  L = [A(1,2), A(2,3)]

Now I need to access the value of x or y from a function:
def GetSomething(seqObj, ?):
  return [obj.? from seqObj]

How can I access x or y through this function ?


More information about the Python-list mailing list