Message61206
Logged In: YES
user_id=80475
FWIW, I had explored this topic at some length with Guido's
input and arrived at somewhat similar guidance. At any given
time, a dynamic object with a __len__() method should report
accurately or not at all (raising a TypeError). Accurate
means that at that moment, len(d) == len(list(d)).
Subsequent mutations may affect the length and the __len__()
method is expected to adjust accordingly. For more notes on
the subject, see the module docstring for
Lib/test/test_iterlen.py
In the face of dynamic inputs, consumer functions like map()
must regard the reported lengths as estimates. However, that
should not lower the standards for objects reporting their
length. That number should continue to have some meaning
such as the point-in-time invariant described above. |
|
Date |
User |
Action |
Args |
2008-01-20 09:59:41 | admin | link | issue1283110 messages |
2008-01-20 09:59:41 | admin | create | |
|