<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p> </p>
    <div class="moz-text-html" lang="x-unicode">
      <p>Hi,</p>
      <p>I'm not sure to understand the real purpose of Vector.</p>
      <p>Is that a new collection ?</p>
      <p>Is that a list with a builtin map() function ?</p>
      <p>Is it a  wrapper to other types ?</p>
      <p>Should it be iterable ?</p>
      <p><br>
      </p>
      <p>The clear need explained before is using fluent interface on a
        collection :</p>
      <p>MyVector.strip().replace("A","E")</p>
      <p>Why do we need Vector to behave like list. We just want to work
        on our strings but with a cleaner/shorter/nicer syntax.</p>
      <p>My idea (not totally clear in my mind) is that Vector should
        behave quite like the type it wraps so having only one type.</p>
      <p>I don't want a collection of strings, I want a MegaString (...)
        which I can use exactly like alone string.</p>
      <p>An iteration on Vector would iter like itertools.chain does.</p>
      <p>At the end, I would only need one more method which would
        return an iterable of the items like MyVector.explode()<br>
      </p>
      <p><br>
      </p>
      <p>For me Vector should be something like that : <br>
      </p>
      <p>class Vector:<br>
        <br>
            def __init__(self, a_list):<br>
                self.data = a_list<br>
                self._type = type(self.data[0])<br>
        <br>
                for data in self.data:<br>
                    if type(data) != self._type:<br>
                        raise TypeError<br>
        <br>
            def __getattr__(self, name):<br>
                fn =  getattr(self._type, name)<br>
        <br>
                def wrapped(*args, **kwargs):<br>
                    self.data = [fn(i, *args, **kwargs) for i in
        self.data]<br>
                    return self<br>
                return wrapped<br>
      </p>
          def explode(self):<br>
                return iter(self.data)<br>
      <br>
      <br>
      I'm not saying it should only handle strings but it seems to be
      the major use case.<br>
      <br>
      Jimmy<br>
      <br>
      <br>
      <div class="moz-cite-prefix">Le 04/02/2019 à 17:12, David Mertz a
        écrit :<br>
      </div>
      <blockquote type="cite"
cite="mid:CAEbHw4avGC8UmaOAKMdc0cwOiJgcCL1YwCt0haCksyijcrd5LQ@mail.gmail.com">
        <div dir="ltr">
          <div dir="ltr">On Mon, Feb 4, 2019 at 7:14 AM Kirill Balunov
            <<a href="mailto:kirillbalunov@gmail.com" target="_blank">kirillbalunov@gmail.com</a>>
            wrote:<br>
          </div>
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div dir="ltr">
                                      <div dir="ltr">
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div dir="ltr">
                                              <div class="gmail_quote">
                                                <div>
                                                  <blockquote
                                                    style="margin:0px
                                                    0px 0px
                                                    40px;border:none;padding:0px">
                                                    <div
                                                      class="gmail_quote"><font
                                                        face="monospace,
                                                        monospace">len(v) 
                                                         # -> 12</font></div>
                                                  </blockquote>
                                                  <blockquote
                                                    style="margin:0px
                                                    0px 0px
                                                    40px;border:none;padding:0px">
                                                    <div
                                                      class="gmail_quote"><font
                                                        face="monospace,
                                                        monospace">v[len] 
                                                         #
                                                        -> <Vector
                                                        of [3, 3, 3, 3,
                                                        3, 3, 3, 3, 3,
                                                        3, 3, 3]></font></div>
                                                  </blockquote>
                                                  <br>
                                                  <font face="arial,
                                                    helvetica,
                                                    sans-serif">In this
                                                    case you can apply
                                                    any function, even </font><span
style="font-family:monospace,monospace">custom_linked_list</span><span
                                                    style="font-family:monospace,monospace"> </span><font
                                                    face="arial,
                                                    helvetica,
                                                    sans-serif">from</font><span
style="font-family:monospace,monospace"> my_inhouse_module.py. </span></div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>I think I really like this idea.  Maybe as an extra
              spelling but still allow .apply() to do the same thing. It
              feels reasonably intuitive to me. Not *identical to*
              indexing in NumPy and Pandas, but sort of in the same
              spirit as predicative or selection based indices.</div>
            <div><br>
            </div>
            <div>What do other people on this thread think? Would you
              learn that easily? Could you teach it?</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div dir="ltr">
                <blockquote style="margin:0px 0px 0px
                  40px;border:none;padding:0px">
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div>
                                                <div class="gmail_quote">
                                                  <div>
                                                    <div><span
                                                        style="font-family:monospace,monospace">>>>
                                                        v[1:]</span>  <br>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div>
                                                <div class="gmail_quote">
                                                  <div><span
                                                      style="font-family:monospace,monospace"><Vector
                                                      of ['Feb', 'Mar',
                                                      'Apr', 'May',
                                                      'Jun', 'Jul',
                                                      'Aug', 'Sep',
                                                      'Oct', 'Nov',
                                                      'Dec']></span>  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div>
                                                <div class="gmail_quote">
                                                  <div>
                                                    <div><span
                                                        style="font-family:monospace,monospace">>>>
                                                        v[i[1:]] # some
                                                        helper class `i</span>`</div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div>
                                                <div class="gmail_quote">
                                                  <div>
                                                    <div><span
                                                        style="font-family:monospace,monospace"><Vector
                                                        of ['an', 'eb',
                                                        'ar', 'pr',
                                                        'ay', 'un',
                                                        'ul', 'ug',
                                                        'ep', 'ct',
                                                        'ov', 'ec']></span>  </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>This feels more forced, unfortunately.  Something short
              would be good, but not sure I like this.  This is really
              just a short spelling of pandas.IndexSlice or numpy.s_  It
              came up in another thread some months ago, but there is
              another proposal to allow the obvious spelling
              `slice[start:stop:sep]` as a way of creating slices.</div>
            <div><br>
            </div>
            <div>Actually, I guess that's all halfway for the above. 
              We'd need to do this still:</div>
            <div><br>
            </div>
          </div>
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
            <div class="gmail_quote">
              <div><font face="monospace, monospace">v[itemgetter(IndexSlicer[1:])]</font></div>
            </div>
          </blockquote>
          <div class="gmail_quote">
            <div> </div>
            <div>That's way too noisy.  I guess I just don't find the
              lowercase `i` to be iconic enough.  I think with a better
              SHORT name, I'd like:</div>
            <div><br>
            </div>
            <div>
              <blockquote style="margin:0px 0px 0px
                40px;border:none;padding:0px">
                <div class="gmail_quote">
                  <div><font face="monospace, monospace">v[Item[1:]]</font></div>
                </div>
              </blockquote>
              <div class="gmail_quote">
                <div><br>
                </div>
                <div> Maybe that's not the name?</div>
              </div>
            </div>
            <div><br>
            </div>
          </div>
          -- <br>
          <div dir="ltr" class="m_-8236848761442098130gmail_signature">Keeping
            medicines from the bloodstreams of the sick; food <br>
            from the bellies of the hungry; books from the hands of the
            <br>
            uneducated; technology from the underdeveloped; and putting
            <br>
            advocates of freedom in prisons.  Intellectual property is<br>
            to the 21st century what the slave trade was to the 16th.<br>
          </div>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Python-ideas mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-ideas@python.org">Python-ideas@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a>
Code of Conduct: <a class="moz-txt-link-freetext" href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a>
</pre>
      </blockquote>
      <br>
    </div>
    <br>
    <div class="moz-cite-prefix">Le 04/02/2019 à 17:12, David Mertz a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEbHw4avGC8UmaOAKMdc0cwOiJgcCL1YwCt0haCksyijcrd5LQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">
        <div dir="ltr">On Mon, Feb 4, 2019 at 7:14 AM Kirill Balunov
          <<a href="mailto:kirillbalunov@gmail.com" target="_blank"
            moz-do-not-send="true">kirillbalunov@gmail.com</a>>
          wrote:<br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div dir="ltr">
                                      <div dir="ltr">
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div class="gmail_quote">
                                              <div>
                                                <blockquote
                                                  style="margin:0px 0px
                                                  0px
                                                  40px;border:none;padding:0px">
                                                  <div
                                                    class="gmail_quote"><font
                                                      face="monospace,
                                                      monospace">len(v) 
                                                       # -> 12</font></div>
                                                </blockquote>
                                                <blockquote
                                                  style="margin:0px 0px
                                                  0px
                                                  40px;border:none;padding:0px">
                                                  <div
                                                    class="gmail_quote"><font
                                                      face="monospace,
                                                      monospace">v[len] 
                                                       #
                                                      -> <Vector
                                                      of [3, 3, 3, 3, 3,
                                                      3, 3, 3, 3, 3, 3,
                                                      3]></font></div>
                                                </blockquote>
                                                <br>
                                                <font face="arial,
                                                  helvetica, sans-serif">In
                                                  this case you can
                                                  apply any function,
                                                  even </font><span
                                                  style="font-family:monospace,monospace">custom_linked_list</span><span
style="font-family:monospace,monospace"> </span><font face="arial,
                                                  helvetica, sans-serif">from</font><span
style="font-family:monospace,monospace"> my_inhouse_module.py. </span></div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>I think I really like this idea.  Maybe as an extra
            spelling but still allow .apply() to do the same thing. It
            feels reasonably intuitive to me. Not *identical to*
            indexing in NumPy and Pandas, but sort of in the same spirit
            as predicative or selection based indices.</div>
          <div><br>
          </div>
          <div>What do other people on this thread think? Would you
            learn that easily? Could you teach it?</div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div dir="ltr">
              <blockquote style="margin:0px 0px 0px
                40px;border:none;padding:0px">
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div class="gmail_quote">
                                                <div>
                                                  <div><span
                                                      style="font-family:monospace,monospace">>>>
                                                      v[1:]</span>  <br>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div class="gmail_quote">
                                                <div><span
                                                    style="font-family:monospace,monospace"><Vector
                                                    of ['Feb', 'Mar',
                                                    'Apr', 'May', 'Jun',
                                                    'Jul', 'Aug', 'Sep',
                                                    'Oct', 'Nov',
                                                    'Dec']></span>  </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div class="gmail_quote">
                                                <div>
                                                  <div><span
                                                      style="font-family:monospace,monospace">>>>
                                                      v[i[1:]] # some
                                                      helper class `i</span>`</div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>
                            <div>
                              <div>
                                <div>
                                  <div>
                                    <div>
                                      <div>
                                        <div>
                                          <div>
                                            <div>
                                              <div class="gmail_quote">
                                                <div>
                                                  <div><span
                                                      style="font-family:monospace,monospace"><Vector
                                                      of ['an', 'eb',
                                                      'ar', 'pr', 'ay',
                                                      'un', 'ul', 'ug',
                                                      'ep', 'ct', 'ov',
                                                      'ec']></span>  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>This feels more forced, unfortunately.  Something short
            would be good, but not sure I like this.  This is really
            just a short spelling of pandas.IndexSlice or numpy.s_  It
            came up in another thread some months ago, but there is
            another proposal to allow the obvious spelling
            `slice[start:stop:sep]` as a way of creating slices.</div>
          <div><br>
          </div>
          <div>Actually, I guess that's all halfway for the above.  We'd
            need to do this still:</div>
          <div><br>
          </div>
        </div>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <div class="gmail_quote">
            <div><font face="monospace, monospace">v[itemgetter(IndexSlicer[1:])]</font></div>
          </div>
        </blockquote>
        <div class="gmail_quote">
          <div> </div>
          <div>That's way too noisy.  I guess I just don't find the
            lowercase `i` to be iconic enough.  I think with a better
            SHORT name, I'd like:</div>
          <div><br>
          </div>
          <div>
            <blockquote style="margin:0px 0px 0px
              40px;border:none;padding:0px">
              <div class="gmail_quote">
                <div><font face="monospace, monospace">v[Item[1:]]</font></div>
              </div>
            </blockquote>
            <div class="gmail_quote">
              <div><br>
              </div>
              <div> Maybe that's not the name?</div>
            </div>
          </div>
          <div><br>
          </div>
        </div>
        -- <br>
        <div dir="ltr" class="m_-8236848761442098130gmail_signature">Keeping
          medicines from the bloodstreams of the sick; food <br>
          from the bellies of the hungry; books from the hands of the <br>
          uneducated; technology from the underdeveloped; and putting <br>
          advocates of freedom in prisons.  Intellectual property is<br>
          to the 21st century what the slave trade was to the 16th.<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Python-ideas mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-ideas@python.org">Python-ideas@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a>
Code of Conduct: <a class="moz-txt-link-freetext" href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>