Re: [Pyobjc-dev] Key/Value Coding
Brought to you by:
ronaldoussoren
From: Pierce T. W. I. <pi...@tw...> - 2003-08-14 21:07:51
|
On Thursday, August 14, 2003, at 12:58 PM, Ronald Oussoren wrote: > > On Thursday, 14 August, 2003, at 21:34, Pierce T. Wetter III wrote: >> >>> I'm going to roll back Bill's patch, it's not very usefull just >>> before a 1.0 release. I'm going to look at the unittest to check if >>> they add tests that should be added to the other KVC unittest files. >> >> Actually, its a trivial change to get "key" to work as well. I sent >> changes independently to bill that fix most of the broken unit tests, >> except the ones where python is subclassing. In that case, the >> objects aren't getting built for some reason, so I'll have to pass on >> those. > > It may be trivial to get this to work, but not necessarily correct. In > python the accessor methods are named 'get_value' and 'set_value' (or > the camelcase variations of those), using accessors named like an > attribute would be confusing. Actually, I think you misunderstand the problem. KeyValueCoding as checked in won't let you do: object.accessor.accessor because it needs to do: object.accesssor().accessor() in python, and its assuming accessor is a plain attribute, so it reutrns object.accessor the function pointer. So you can walk chains of plain attributes, but you can't walk any that have accessors involved, unless they have a "get" or "get_" method. Since there's no "getLen()" or "getCapitalize()" on string, or 99% of the methods of the other system classes, KVC has to get the results of m=getattr, and if it is callable, return m(). |