On Sat, Feb 2, 2019 at 10:00 PM MRAB firstname.lastname@example.org wrote:
Perhaps a reserved attribute that let's you refer to the vector itself instead of its members, e.g. '.self'?
<Vector of [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]>
I like that! But I'm not sure if '.self' is misleading. I use an attribute called '._it' already that does exactly this. But since we're asking the length of the list or tuple or set or deque or etc that the Vector wraps, does it feel like it would be deceptive to call them all '.self'?
I'm really not sure. I could just rename '._it' to '.self' and get the behavior you show (well, I still need a little checking whether the thing wrapped is a collection or an iterator ... I guess a '.self' property. Or some other name to do that).
You remind me that I need to at .__getitem__() too so I can slice and index Vectors. But I know how to do that easily enough.