Mark wrote: You enjoy making life difficult for yourself :) You've assigned strings to the name func, just assign the functions themselves? Like.
> > for func in max, min: > print(func.__name__, func(range(5))) > > Output. > > max 4 > min 0 > > I wouldn't say I enjoy making life difficult for myself, but it is one of my strengths ;) That would work, I think, for the function example I gave you, but the example I gave in response to Danny used the same trick on lists: that is, I want to iterate through a bunch of lists, subsequently printing both list members (via indexing, for example) and the name of the list I'm on. I might even want to do the same of a dict, or some random data structure. Unless it's just really a bad idea to code like this. But certainly when the .__name__ attribute is available, that makes more sense. I'll change that part.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor