The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Mar 14 12:21:17 EDT 2016


On 14/03/2016 14:43, BartC wrote:
> On 13/03/2016 09:39, Steven D'Aprano wrote:
>> On Sun, 13 Mar 2016 04:54 am, BartC wrote:
>
>>> Common sense tells you it is unlikely.
>>
>> Perhaps your common sense is different from other people's common
>> sense. To
>> me, and many other Python programmers, it's common sense that being
>> able to
>> replace functions or methods on the fly is a useful feature worth having.
>> More on this below.
>>
>> Perhaps this is an example of the "Blub Paradox":
>
> Perhaps it's time to talk about something which many languages have, but
> Python hasn't. Not as far as I know anyway.
>
> That's references to names (sometimes called pointers). So if I write:
>
>   a = 100
>   f(a)
>
> then function f gets passed the value that a refers to, or 100 in this
> case. But how do you pass 'a' itself?
>
> Perhaps you can say:
>
>    f('a')
>
> and f can do some sort of lookup, if it knows the caller's context, for
> such a name and retrieve the value that way. But that's rather
> heavy-handed, and f can't distinguish between a reference to a name, and
> a string.

http://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list