On Sat, Feb 2, 2019 at 10:00 PM MRAB <python@mrabarnett.plus.com> wrote:
Perhaps a reserved attribute that let's you refer to the vector itself
instead of its members, e.g. '.self'?

>>> len(v)
<Vector of [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]>
 >>> len(v.self)
12

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.

--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.