[Pythonmac-SIG] objc methods to pythonese

Scott Frankel leknarf at pacbell.net
Thu Mar 23 20:53:47 CET 2006


Apologies in advance for this tangential question.

I'm trying to wrap my head around how Objective-C methods are  
constructed -- and more importantly, how they're converted to Python  
methods.  Doco I've found uses as an example a method with white  
space between the parts of the method name.  Working with Python has  
made me gun shy with respect to white space ;)

Is the white space syntactically significant?  i.e.:

     [rectangle setWidth:width height:height];
                                                  ^

If I understand correctly, this would translate in Python to:

     rectangle = setWidthheight_(width, height)

Correct that the 'h' in the "height" part of the method name is not  
capitalized?



How about the following?

     - (id)tableView:(NSTableView *)tableView
     objectValueForTableColumn(NSTableColumn *)tableColumn
             row:(int)row

Would this translate like so?

     def tableViewobjectValueForTableColumnrow_(tableView,  
tableColumn, row):




Thanks in advance!  Reminds me of a friend's reverse polish notation  
calculator ...
Scott









More information about the Pythonmac-SIG mailing list