Re: [Pyobjc-dev] Default to returning (void)?
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-02-16 05:11:43
|
On Feb 16, 2004, at 12:00 AM, b.bum wrote: > On Feb 15, 2004, at 8:36 PM, Bob Ippolito wrote: >> At least in Python 2.3.x, the only way to generate "LOAD_CONST 0 >> (None) / RETURN_VALUE" is either a bare return, or no return at all. >> If you analyze the bytecode for a function, and it has no other >> RETURN_VALUE pairs.. then you can safely assume that it should >> default to void. > > Eeeewwwww.... > > Nuts. Defaulting to a (void) return will break for any getter, so I > can see how trying to figure this out to do the right thing would be > preferable. Yeah, it's gross, but analyzing the bytecode *would* work ;) > Barring automated intelligence, being able to do something like the > following would be preferable to the crypting exposed signatures we > have today. > > def setContent_(self, someContent): > print "Setting content...." > self._content = someContent > setContent_ = selector(setContent_, type='setter') > objc.makeSetter(setContent_) # this would be even better > > def takeAction_(self, sender): > pass > takeAction_ = selector(takeAction_, type='action') Why not objc.getter / objc.setter / objc.action? This is really why Python needs a way to decorate functions that isn't so f*!@#!ing ugly. -bob |