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

BartC bc at freeuk.com
Mon Mar 14 21:35:25 EDT 2016


On 15/03/2016 01:27, Steven D'Aprano wrote:
> On Tue, 15 Mar 2016 07:31 am, BartC wrote:
>
>> But how do you pass something that refers to a itself?
>
> You can't. "Names" are not first-class values in Python.

This was my real point. Python includes some odd features that you say 
are indispensable (mutable function names), but excludes others which 
are standard in some other languages.

And name references are more difficult to emulate.

> I'm only aware of a handful of languages which support this sort of
> reference semantics: Pascal (of course!), Algol uses the similar "pass by
> name" semantics using thunks, C++, and Visual Basic.

Some of those use references to achieve what Python already does. For 
Python to have pass-by-reference, it would need references to references.


-- 
Bartc



More information about the Python-list mailing list