Miki Tebeka <miki.teb...@gmail.com> added the comment: Hmmm, too much time has passed and my 1bit memory has overflowed since :)
IIRC it has to do with the fact that not all nodes in BeautifulSoup has a "name" attribute. I wanted to count how may "tr" there were, so len(filter(lambda n: n == "tr", map(attrgetter("name"), soup))) was what I wanted to do, but I got AttributeError. The natural way to me would be len(filter(lambda n: n == "tr", map(attrgetter("name", ""), soup))) but instead I had to do len(filter(lambda n: n == "tr", map(lambda n: gettattr(n, "name", ""), soup))) Another thing I can think of is for usage in count/max ... when some of the objects don't have the attribute you're looking for and it's by design (bad one maybe). You'd like to be able to do: max(map(itemgetter("time", 0)), articles) _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4124> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com