On 11/24/2015 9:34 AM, Antoon Pardon wrote:

I agree that the tutorial should talk about default argument objects (which have values) instead of conflating 'object' with 'value'.

Op 20-11-15 om 13:12 schreef Ned Batchelder:

I'm not sure what your goal is at this point.  Are you:

   1) still unsure what the behavior is, or
   2) trying to understand why it behaves that way, or
   3) hoping to change Python, or
   4) trying to convince us that your language is better, or
   5) something else?

Maybe just have us recognize that some aspects of python indeed are bizarre.

The current behavior under discussion is: default argument expressions are evaluated once at function creation time to produce default argument objects that are bound to the function object. I do not see this as bizarre.

That there is nothing wrong with him thinking so.

I do recognize that some would prefer that default argument expressions be treated differently, that

def f(a=expression): pass

be compiled to operate as the following does now

def f(a=None):
    a = a if a is not None else expression

perhaps with None replaced with a hidden object() instance.

I find the continuing fuss over the choice that was made to be the bizarre thing here.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to