Re: [Pyobjc-dev] __getitem__objectForKey_ shadows __getitem__
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2009-10-13 11:14:39
|
On 9 Oct, 2009, at 14:46, James R Eagan wrote: > > > > From what I can tell, the relevant code is in pyobc-core/Lib/objc/ > _convenience.py:88 : > > if sel in CONVENIENCE_METHODS: > v = CONVENIENCE_METHODS[sel] > for nm, value in v: > if nm in type_dict and isinstance(type_dict[nm], > selector): > > # Clone attributes of already existing version > > t = type_dict[nm] > v = selector(value, selector=t.selector, > signature=t.signature, > isClassMethod=t.isClassMethod) > > type_dict[nm] = v > else: > type_dict[nm] = value > > This seems to be a fairly core portion of the PyObjC, and I have not > explored the ramifications of modifying the inner if ... else block > to only add the convenience methods if the nm is not already in > type_dict. Should that else really be an "elif nm not in type_dict" ? Yes. I've just commited a patch that does that. The patch is not perfect though, if you override objectForKey: in a subclass that subclass will once again get the generic __getitem__ from pyobjc. Ronald > > Cheers! > James > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference_______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |