Re: [Python-Dev] SoC proposal: multimedia library

2007-03-26 Thread Pete Shinners
Lino Mastrodomenico  gmail.com> writes:
> I would like to participate as a student in google Summer of Code and
> I'm interested in feedback on a multimedia library for Python.
> 
> The library I propose should have the following features:
> * the capability to extract and decompress video and audio from a
> few common multimedia file format;
> * and, vice versa, it can create a compressed video file from a
> series of still images and from uncompressed audio;
> * it should have an interface as simple and pythonic as possible;

My main question is what is the image and sound container passed back to Python?
This single thing along would be worth a SoC if it could be implemented across
all libraries.

Will your image objects be transferrable to PIL, Pygame, PyOpengl, Numpy,
Pythonmagick, Pycairo, wxPython, etc? It would be best if this could avoid the
"fromstring/tostring" mojo that always requires and extra copy of the data for
each transfer.

If the core numpy arrays could ever get added to the Python standard library,
this problem would be mostly solved. I believe there was a SoC for Python last
year for this exact array problem.

Your proposal sounds dangerously close to implementing some file demuxing by
yourself. Do not dare touch any of the file bits in your own library. This
proposal should only be for getting data from existing decompression libraries
into some general Python container. 


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Representation of 'nan'

2007-06-12 Thread Pete Shinners

The repr() for a float of 'inf' or 'nan' is generated as a string (not a
string literal). Perhaps this is only important in how one defines repr().
I've filed a bug, but am not sure if there is a clear solution.

https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732212&group_id=5470

# Repr with a tuple of floats

repr((1.0, 2.0, 3.0))

'(1.0, 2.0, 3.0)'

eval(_)

(1.0, 2.0, 3.0)

# Repr with a tuple of floats, plus nan

repr((1.0, float('nan'), 3.0))

'(1.0, nan, 3.0)'

eval(_)

NameError: name 'nan' is not defined

There are a few alternatives I can think are fairly clean. I think I'd
prefer any of these over the current 'nan' implementation. I don't think it
is worth adding a nan literal into the language. But something could be
changed so that repr of nan meant something.

Best option in my opinion would be adding attributes to float, so that
float.nan, float.inf, and float.ninf are accessable. This could also help
with the odd situations of checking for these out of range values. With that
in place, repr could return 'float.nan' instead of 'nan'. This would make
the repr string evaluatable again. (In contexts where __builtins__ has not
been molested)

Another option could be for repr to return 'float("nan")' for these, which
would also evaluate correctly. But this doesn't seem a clean use for repr.

Is this worth even changing? It's just an irregularity that has come up and
surprised a few of us developers.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com