views:

37

answers:

1

Hello,

I have a method that returns an IEnumerable of some type. Now I was wondering how I can iterate the IEnumerable with Ironpython?

thanks

+3  A: 

A simple for loop?

from System import *
from System.Collections.Generic import *
names = List[str]()

def get_names():
  names = List[str]()
  names.Add("Sam")
  names.Add("Carla")
  names.Add("Woody")
  names.Add("Rebecca")
  names.Add("Cliff")
  names.Add("Norm")
  return names

for name in get_names():
  print name
John Zablocki