On Mar 23, 2006, at 2:53 PM, Scott Frankel wrote: > 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?
You're not assigning the result of that method to 'rectangle'. You want: rectangle.setWidth_height_(width, height) each ':' gets replaced in the python signature with an underscore, and 'rectangle' is the object you're calling setWidth:height: on. > How about the following? > > - (id)tableView:(NSTableView *)tableView > objectValueForTableColumn(NSTableColumn *)tableColumn > row:(int)row > > Would this translate like so? > > def tableViewobjectValueForTableColumnrow_(tableView, > tableColumn, row): That is a method declaration, not a function - don't forget 'self': def tableView_objectValueForTableColumn_row_(self, tableView, tableColumn, row): Zac _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig