Hi everyone, first participation in Python’s mailing list, don’t be too hard on me
Some suggested above to change the definition of len in the long term. Then I think it could be interesting to define len such as : - If has a finite length : return that length (the way it works now) - If has a length that is infinity : return infinity - If has no length : return None There’s an issue with this solution, having None returned add complexity to the usage of len, then I suggest to have a wrapper over __len__ methods so it throws the current error. But still, there’s a problem with infinite length objects. If people code : for i in range(len(infinite_list)): # Something It’s not clear if people actually want to do this. It’s opened to discussion and it is just a suggestion. If we now consider map, then the length of map (or filter or any other generator based on an iterator) is the same as the iterator itself which could be either infinite or non defined. Cheers > On 29 Nov 2018, at 06:06, Anders Hovmöller <bo...@killingar.net> wrote: > > >>> +1. Throwing away information is almost always a bad idea. >> >> "Almost always"? Let's take this seriously, and think about the >> consequences if we actually believed that. If I created a series of >> integers: > > “Almost". It’s part of my sentence. I have known about addition for many > years in fact :) > > / Anders > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/