<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thanks Chris for your idea.<br>
      <br>
      Right now, I could not think of an example "non-trivial and simple
      and small enough" especially in the context of JSON. But maybe the
      other proponents have.<br>
      <br>
      <br>
      The part of data series from simulations (so proper datastructures
      available). So, data lists which aren't filled yet or have not
      filled till a certain amount yet I need some special pieces from
      them like the first, a sample, the 300th, etc. This was the case
      recently.<br>
      <br>
      <br>
      There was also the case of a refactoring going on in some project,
      where things changed from dicts to lists (upgrade of a third party
      lib, I think). As a consequence, I needed to blow up certain
      functions from n one-liners [a.get] to n four-liners [try/except].<br>
      <br>
      <br>
      If I had know that this would be relevant to this discussion, I
      would have written it down, but it's just the negative
      memory/experience.<br>
      <br>
      <br>
      Regards,<br>
      Sven<br>
      <br>
      <br>
      On 03.03.2017 21:16, Chris Barker wrote:<br>
    </div>
    <blockquote
cite="mid:CALGmxEJwcfefuE_RbH6PT_xLnbH3m+w_4H7bPMOwghFi=a4VdA@mail.gmail.com"
      type="cite">
      <div dir="ltr">About JSON and schema-less data:
        <div><br>
        </div>
        <div>I need to deal with this fairly often as well, but:</div>
        <div><br>
        </div>
        <div>JSON has a data model that includes both mappings and
          sequences:</div>
        <div><br>
        </div>
        <div>Sequences (arrays, lists, etc) are the "right" thing to use
          when an object has zero or more of something. Usually, these
          somethings are all the same. So you may need to answer the
          question: how many somethings are there? but rarely: if there
          are less than this many somethings, then I should use  a
          default value.</div>
        <div><br>
        </div>
        <div>Mappings (objects, dicts) are the "right" thing to do when
          an object has a bunch of somethings, and each of them may be
          different and nameable. In this case, the if this name is in
          there, use its associated object, otherwise use a default" is
          a pretty common action.</div>
        <div><br>
        </div>
        <div>so if your JSON is well formed (and I agree, being
          schema-less does not mean it is poorly formed) then it should
          already be using the appropriate data structures, and you are
          good to go.</div>
        <div><br>
        </div>
        <div>That being said, maybe a concrete example would persuade
          the skeptics among us -- though I understand it may be hard to
          find one that is both non-trivial and simple and small enough
          to post to a mailing list...</div>
        <div><br>
        </div>
        <div>-CHB</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Mar 3, 2017 at 12:09 PM, Chris
          Barker <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div class="gmail_extra">
                <div class="gmail_quote"><span class="">On Fri, Mar 3,
                    2017 at 12:02 PM, Sven R. Kunze <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:srkunze@mail.de" target="_blank">srkunze@mail.de</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000"><span> </span><span>
                          <blockquote type="cite">For me to think
                            (list/tuple).get() was needed would be if
                            lots of folk either cast their lists to
                            dicts or made their own list-dict class to
                            solve that problem. <br>
                          </blockquote>
                          <br>
                        </span> The easier solution would be to provide
                        list.get ;-)<br>
                      </div>
                    </blockquote>
                    <div><br>
                    </div>
                  </span>
                  <div>Exactly -- I think that was the point -- if there
                    is a lot of custom code out there essentially adding
                    a get() to a list -- then that would indicate that
                    is is broadly useful.</div>
                  <div><br>
                  </div>
                  <div>For my part, I think casting a list to a dict is
                    often the RIGHT way to address these issues.</div>
                  <div><br>
                  </div>
                  <div>-CHB</div>
                  <div><br>
                  </div>
                </div>
                <span class="">
                  <div><br>
                  </div>
                  -- <br>
                  <div class="m_3481314864530649412gmail_signature"
                    data-smartmail="gmail_signature"><br>
                    Christopher Barker, Ph.D.<br>
                    Oceanographer<br>
                    <br>
                    Emergency Response Division<br>
                    NOAA/NOS/OR&R            <a
                      moz-do-not-send="true"
                      href="tel:%28206%29%20526-6959"
                      value="+12065266959" target="_blank">(206)
                      526-6959</a>   voice<br>
                    7600 Sand Point Way NE   <a moz-do-not-send="true"
                      href="tel:%28206%29%20526-6329"
                      value="+12065266329" target="_blank">(206)
                      526-6329</a>   fax<br>
                    Seattle, WA  98115       <a moz-do-not-send="true"
                      href="tel:%28206%29%20526-6317"
                      value="+12065266317" target="_blank">(206)
                      526-6317</a>   main reception<br>
                    <br>
                    <a moz-do-not-send="true"
                      href="mailto:Chris.Barker@noaa.gov"
                      target="_blank">Chris.Barker@noaa.gov</a></div>
                </span></div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature"><br>
          Christopher Barker, Ph.D.<br>
          Oceanographer<br>
          <br>
          Emergency Response Division<br>
          NOAA/NOS/OR&R            (206) 526-6959   voice<br>
          7600 Sand Point Way NE   (206) 526-6329   fax<br>
          Seattle, WA  98115       (206) 526-6317   main reception<br>
          <br>
          <a moz-do-not-send="true" href="mailto:Chris.Barker@noaa.gov"
            target="_blank">Chris.Barker@noaa.gov</a></div>
      </div>
    </blockquote>
    <br>
  </body>
</html>