Re: [Pyobjc-dev] NSRects and NSPoints as tuples...
Brought to you by:
ronaldoussoren
From: Jack J. <Jac...@or...> - 2003-01-08 23:03:33
|
On woensdag, jan 8, 2003, at 22:58 Europe/Amsterdam, Ronald Oussoren wrote: > This is working as designed, but not because tuples are more pythonic > than structs (I'm don't even think tuples are more pythonic). They are > tuples because PyObjC doesn't know anything about NSRect and other > struct-types, other than what it can extract from the runtime. The > runtime doesn't know field names, but only the number and types of the > fields. > > It would be possible to add an interface to specify custom mappings > for structure types, but IMHO that is post-1.0 work. There's a new builtin Python type, structsequence, that is two-faced: you can access the members by name or by index. os.stat() is one of the calls that uses it. Unfortunately the C interface is rather baroque. At least, I was going to use it for some of the values returned by Mac toolbox calls, but I've pushed it forward for the time being as I didn't understand it. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |