On 5-aug-04, at 21:45, Neil Schemenauer wrote: > On Thu, Aug 05, 2004 at 09:28:13PM +0200, Ronald Oussoren wrote: >> On 5-aug-04, at 21:17, Gustavo Niemeyer wrote: >>> def funcname(...): >>> ... >>> funcname.signature = "v@:@i" >> >> That should be workable for this specific example. > > Even nicer if '_' is bound to the last function defined. > > class SomeClass(objc): > def funcname(...): > ... > _.signature = "v@:@i" > > The objc metaclass could take the 'signature' function attribute and > transform the function. > >> It wouldn't work for the objc.accessor example. The objc.accessor >> function/decorator deduces the right kind of signature from the >> name and arguments of the function. > > Can't the metaclass do that? Not every method is a property accessor. The metaclass does calculate a default signature (all arguments are objects and the result is an object) when it doesn't have better information (such as the signature of a method with the same name in a superclass). Sadly enough that isn't good enough for property setters. Some parts of Cocoa require that a setter returns 'void'. I'm trying to push the automatic detection of the right signature as far as I can get to avoid having to use explicit annotations in user code, but sometimes you just cannot avoid adding annotations. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4