BartC <b...@freeuk.com>:

> Yes. In the languages I create, pretty much everything is mutable,
> provided it can supply an l-value. Constructs such as those for empty
> lists ([] in Python, () in mine) aren't l-values.
>
> But it doesn't apply default values.

Python's default-value semantics is analogous to C++:

========================================================================
#include <iostream>

using namespace std;

static int z;

static void f(int &x = z)
{
    x++;
}

int main()
{
    cout << z << endl;
    f();
    cout << z << endl;
    f();
    cout << z << endl;
    return 0;
}
========================================================================

which prints:

    0
    1
    2


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

Reply via email to