On May 8, 3:03 pm, walterbyrd <walterb...@iname.com> wrote: > This works, but it seems like there should be a better way. > > -------------- > week = ['sun','mon','tue','wed','thu','fri','sat'] > for day in week[week.index('tue'):week.index('fri')]: > print day > ---------------
I think you should provide much more information, primarily why you want to do this. What is the larger goal you are trying to achieve? In the absence of further information, it seems to me that you are trying to create an enumerated type. For various ideas to achieve this simply, depending on your purpose, see http://norvig.com/python-iaq.html If you want a more thorough treatment, maybe try this package: http://pypi.python.org/pypi/enum/ There may be other recipes and packages; you can Google for them using keywords "python enum" or similar. John -- http://mail.python.org/mailman/listinfo/python-list