News for hackers. Stuff that matters.
Re:Ask HN: What do want to see in programming language? by S4M on Sunday May 21, 2017 @05:07PM (#14389260)
In Python, I'd love to add something like const in a function definition, for the arguments, to say that the arguments will not be modified by the function. For example, I would want the following code to somehow return an error

    def get_last_element(const my_list):
        return mylist.pop()
Re:Ask HN: What do want to see in programming language? by rdnetto on Thursday May 25, 2017 @06:25PM (#14420633)
You can do that in Python by converting the list to a tuple before passing it in. The need for a defensive copy is unavoidable as long as you're using mutable data types though.