[Pyobjc-dev] A question of concience
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-07-08 19:30:10
|
In a private conversation Dan Grassi mentioned that methods like the one below are transformed into Python methods in an unexpected way. Specifically: -(void)getNumberOfRows:(int*)rowCount columns:(int*)columnCount; // both are output parameters is translated into getNumberOfRows_columns_(self) -> (None, rowCount, columnCount) He expected that the result would be (rowCount, columnCount). I think he has a point. The current translation is the result of applying the basic rule a little too strictly. The basic rule says: The return value of methods with output arguments is a tuple containing the original return value, followed by the values of all output arguments in order. A return type of 'void' is usually translated into a method returning None, and therefore the return value for the method mentioned above is a tuple with None as its first element (the original return value). Just ignoring the original return value if this is always void would be more usefull, as a method returning void is a method that does *not* return a value when viewed as an Objective-C method. This would make the translation of getNumberOfRows:columns: more natural. There is one problem with this change: backward compatibility. If we'd apply this change, we might break code that currently uses methods like getNumberOfRows:columns:. The current users might also use code that wouldn't break, like this: rows, cols = obj.getNumberOfRows_columns_()[1:] I'd rather not break backward compatibility, but this change would increase the useability of PyObjC. Any opinions? Ronald |