Python was designed (was Re: Multi-threading in Python vs Java)

Lele Gaifax lele at metapensiero.it
Wed Oct 23 11:56:54 EDT 2013


Gregory Ewing <greg.ewing at canterbury.ac.nz> writes:

> Steven D'Aprano wrote:
>> On Tue, 22 Oct 2013 09:38:16 +0200, Lele Gaifax wrote:
>>
>>>The actual syntax would be
>>>
>>>  [object method: arg1 withSomething: arg2 withSomethingElse: arg3]
>>
>> I don't get how to map that to Python's syntax.
>
> It's roughly morally equivalent to
>
>    object.method(arg1, withSomething = arg2, withSomethingElse = arg3)
>
> But there are several reasons why it's not really equivalent
> to that. PyObjC actually maps it to
>
>    object.method_withSomething_withSomethingElse_(arg1, arg2, arg3)
>
> which is very close to what Objective C is doing under the hood.

Right (IIRC, I initially used a double underscore as separator), and
that's because in ObjC the method

  [object method:arg1 withSomething:arg2 withSomethingElse:arg3]

is completely unrelated to

  [object method:arg1 withSomethingElse:arg3 withSomething:arg2]

I wish I had a way, at the time (we were in the 1.x era), to use
something like OrderedDict to carry around the kwargs argument of a
function/method, that could let me use a nicer syntax... I did even
cook-up a quick&dirty patch, but being too biased toward the "dirty"
side it did not go too far.

ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list