[Pythonmac-SIG] QuickTime.Qt beta & SequenceGrabber, anybody use it?

Ronald Oussoren ronaldoussoren at mac.com
Tue Aug 17 08:00:00 CEST 2004


On 17-aug-04, at 0:07, Jack Jansen wrote:

>
> On 16 Aug 2004, at 23:50, Jerome wrote:
>
>> thanks, that's a start, problem is the
>> Carbon.Cm.OpenDefaultComponent() won't allow a 0 for 2nd argument to
>> allow any subtype, so i dont know how to try my example otherwise,
>> putting other subtypes just get null componentInstances
>
> You should pass '\0\0\0\0': OSType values (the ubiquitous 4-char 
> single quoted strings in C) must be strings on the Python side.
>
> I keep going back and forward on this design: sometimes I want to 
> allow integers too, sometimes I think it's too error-prone and want to 
> keep things the way the are, sometimes I want to do something 
> in-between (such as allow only 4-char Python strings or the specific 
> integer values 0 and maybe -1).

Some newer API's return OSType values as part of a dictionary, such as 
the Cocoa file management API's. PyObjC converts those in integers, 
because it doesn't know better.

>
> Anyone have any opinions on this?

Maybe a subclass of 'int' that accepts 4-character-codes? I have one 
python one lying around that also has a custom __repr__ and __str__.

Or accept either, that would be backward compatible.

Ronald



More information about the Pythonmac-SIG mailing list