Python interface "sequence protocol"

Skef Iterum <[email protected]> Sun, 3 Feb 2019 01:42:14 -0800
Newsgroups gmane.comp.fonts.fontforge.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============2690834612857546901==
Content-Type: multipart/alternative;
 boundary="------------1EB259D74F6613919A23B97A"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------1EB259D74F6613919A23B97A
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Note that:

 1. (At best) this question relates to a release after the upcoming one,
    so there is no hurry.
 2. I\m using an out of date version of the docs because sub-links work.

Some of the important Python objects, including Layer and Contour, have 
what the documentation calls a "sequence protocol":

http://dmtr.org/ff.php#Layer

It's clear how this interface is supposed to work for /changing/ an 
existing element or /appending/ a new element. Contour also has 
insertPoint for adding a point in the middle of the point sequence. But 
what about the other operations? How should one reduce the number of 
contours in a layer or points in a contour? Calling del on a layer array 
element results in a segfault. Maybe that operation should throw an 
exception to avoid "holes", but the existing interface just seems 
incomplete.

On the meta-level, how does the project wish to answer questions of this 
type at present?

(fontParts, rising from RoboFont ashes, only exposes a read-only tuple 
of contours in the corresponding context, and uses methods otherwise.)

Skef


--------------1EB259D74F6613919A23B97A
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Note that:</p>
    <ol>
      <li>(At best) this question relates to a release after the
        upcoming one, so there is no hurry. <br>
      </li>
      <li>I\m using an out of date version of the docs because sub-links
        work. <br>
      </li>
    </ol>
    <p>Some of the important Python objects, including Layer and
      Contour, have what the documentation calls a "sequence protocol":</p>
    <p><a class="moz-txt-link-freetext" href="http://dmtr.org/ff.php#Layer">http://dmtr.org/ff.php#Layer</a></p>
    <p>It's clear how this interface is supposed to work for <i>changing</i>
      an existing element or <i>appending</i> a new element. Contour
      also has <tt>insertPoint</tt> for adding a point in the middle of
      the point sequence. But what about the other operations? How
      should one reduce the number of contours in a layer or points in a
      contour? Calling <tt>del</tt> on a layer array element results in
      a segfault. Maybe that operation should throw an exception to
      avoid "holes", but the existing interface just seems incomplete. <br>
    </p>
    <p>On the meta-level, how does the project wish to answer questions
      of this type at present?<br>
    </p>
    <p>(fontParts, rising from RoboFont ashes, only exposes a read-only
      tuple of contours in the corresponding context, and uses methods
      otherwise.)</p>
    <p>Skef<br>
    </p>
  </body>
</html>

--------------1EB259D74F6613919A23B97A--


--===============2690834612857546901==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============2690834612857546901==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html

--===============2690834612857546901==--