functions, list, default parameters
Robert Kern
robert.kern at gmail.com
Tue Nov 2 00:07:00 EDT 2010
On 2010-11-01 22:31 , Lawrence D'Oliveiro wrote:
> In message<8j1seqFa1eU2 at mid.individual.net>, Gregory Ewing wrote:
>
>> Steven D'Aprano wrote:
>>
>>> And how does Python know whether some arbitrary default object is mutable
>>> or not?
>>
>> It doesn't, that's the whole point.
>
> Of course it knows. It is the one defining the concept in the first place,
> after all.
No, the Python interpreter doesn't define the concept. The Python language
developers did. "Immutable objects" are just those without an obvious API for
modifying them. With various trickeries, I can mutate any immutable object. The
Python interpreter doesn't know what's an "obvious API" and what isn't. It's a
reasonably vague concept that doesn't have an algorithmic formulation.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list