Re: [Pyobjc-dev] [Pythonmac-SIG] Towards PyObjC 3.0
Brought to you by:
ronaldoussoren
From: Greg E. <gre...@ca...> - 2014-06-04 03:06:42
|
Nicholas Cole wrote: > In fact, if you are right that > there is now some kind of translation table that could make PyObjC > method names even better, that would be really brilliant. I've just been looking at "A Swift Tour" here: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-XID_1 and it seems that the reality is rather less brilliant than that. The following paragraph sets some alarm bells ringing: "Methods on classes have one important difference from functions. Parameter names in functions are used only within the function, but parameters names in methods are also used when you call the method (except for the first parameter)." Then it gives an example: class Counter { ... func incrementBy(amount: Int, numberOfTimes times: Int) { ... and how to call it: counter.incrementBy(2, numberOfTimes: 7) It doesn't explicitly say at that point, but I strongly suspect that you *have* to call it *exactly* like that, and not any of these ways: counter.incrementBy(2, 7) counter.incrementBy(amount: 2, numberOfTimes: 7) counter.incrementBy(numberOfTimes: 7, amount: 2) In other words, it's just syntactic sugar for an Objective-C method call, and not a true keyword-argument system. Which is rather disappointing, and doesn't help at all with interfacing to Python. -- Greg |