[Python-3000] PEP 368: Standard image protocol and class (original) (raw)

Edin Salkovic edin.salkovic at gmail.com
Tue Jul 3 10:11:59 CEST 2007


Hi Lino,

On 7/1/07, Lino Mastrodomenico <l.mastrodomenico at gmail.com> wrote:

_getitem_(integer) -> line

Returns the line at the specified (y) position.

Just some ideas to think about.

  1. Have you considered adding a separate lines property to the Image protocol?

  2. Does one, by default, want to iterate over lines or over pixels of an image? Even your example iterates over pixels:

    iterate over an image

    for line in rgb_image: for pixel in line: # swap red and blue, and set green to 0 pixel.value = pixel.b, 0, pixel.r

why not just:

iterate over an image

for pixel in rgb_image: pixel.value = pixel.b, 0, pixel.r

  1. The pixels method (same for the possible lines property that I mentioned above) should probably be a property, i.e.: pixels -> iterator[pixel], not: pixels() -> iterator[pixel]

P.S.: You might also inform the SciPy/NumPy lists about the PEP.

Keep up the good work!, Edin



More information about the Python-3000 mailing list