25 Feb
2014
25 Feb
'14
3:47 p.m.
On 02/25/2014 03:40 PM, Greg Ewing wrote:
Steven D'Aprano wrote:
(1) __len__ can return *any* float, regardless of value, including lengths of 0.5, NAN, 1e300, etc. This is undesirable because lengths of sequences should be positive or zero whole numbers,
What about things other than sequences?
For a vector type, for example, it would make sense for len(v) to return the magnitude of the vector.
Very good point. To which I reply: singledispatch ! ;) http://docs.python.org/dev/whatsnew/3.4.html#whatsnew-singledispatch -- ~Ethan~