News for hackers. Stuff that matters.
Re:Strict Python function parameters by remexre on Sunday January 23, 2022 @01:04PM (#30048520)
Common Lisp takes expressions for default arguments, and has the "fixed" behavior; when one wants a persistent value, they do either:

    (let ((my-list '(1 2 3)))
      (defun foo (&optional (l my-list))
        (setf (car l) 'hello)
        l))
or, more often, just make it a special variable of some sort:

    (defvar *my-list* '(1 2 3))
    (defun foo (&optional (l *my-list*))
      (setf (car l) 'hello)
      l))
This seems to work fine, and brings attention to "I have an object that supports mutation, and I'm actually going to mutate it," which is an unusual enough case to be worth calling out.
Re:Strict Python function parameters by lispm on Sunday January 23, 2022 @01:09PM (#30048581)
You are modifying literal data, which is not a good idea.