Re: [Pyobjc-dev] Best way to rectify attribute/method name conflation?
Brought to you by:
ronaldoussoren
From: Zachery B. <zb...@ur...> - 2004-03-28 15:20:23
|
On Mar 28, 2004, at 10:14 AM, Zachery Bir wrote: > def copyWithZone_(self, zone): > cell = super(IconAndTextCell, self).copyWithZone_(zone) > cell.setImage_(self.getImage()) > return cell > > [snip] > > Am I right? Apparently not: >>> from Foundation import * >>> from AppKit import * >>> cell = NSCell.alloc().init() >>> cell.image <native-selector image of <NSCell: 0x372550>> >>> cell.image() >>> image = NSImage.alloc().init() >>> cell.setImage_(image) >>> cell.image <native-selector image of <NSCell: 0x372550>> >>> cell.image() NSImage 0x31d490 Size={0, 0} Reps=() >>> So, I guess I needn't worry about the actual attribute version of 'image' and I should use the second example above, and never worry about referencing the actual attribute. Ah, encapsulation :^) Zac |