functions, list, default parameters
ldo at geek-central.gen.new_zealand
Thu Nov 4 08:07:31 CET 2010
In message <mailman.504.1288718704.2218.python-list at python.org>, Robert Kern
> On 11/2/10 2:12 AM, Lawrence D'Oliveiro wrote:
>> In message<mailman.475.1288670833.2218.python-list at python.org>, Robert
>> Kern wrote:
>>> "Immutable objects" are just those without an obvious API for modifying
>> They are ones with NO legal language constructs for modifying them. Hint:
>> if a selector of some part of such an object were to occur on the LHS of
>> an assignment, and that would raise an error, then the object is
>> immutable. The interpreter already knows all this.
> Incorrect. RHS method calls can often modify objects.
So bloody what?
> Show me the algorithm that the interpreter can use to determine whether or
> not an object is mutable.
Go look in the code for the one it already uses in places where immutable
objects are currently required.
>>> With various trickeries, I can mutate any immutable object.
>> None within the Python language itself. Which is what we’re talking about
>> here: a language construct which is probably one of the top 3 sources of
>> grief to Python newbies. And not-so-newbies.
> "import ctypes" is within the Python language.
And in the old BASIC days, we had “PEEK” and “POKE”. So by your reasoning,
that invalidated the language rules, too.
More information about the Python-list