On 2017-10-11, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote:
> Neil Cerutti wrote:
>> I dig const qualifiers, even though I'm comletely fine with
>> their absence from Python.
>
> Out of curiosity, do you have any insights into why you like
> them in C++, if you don't miss them in Python?

I can tell at a glance if a parameter is expected to be
modifiable just by looking at the function signature. Also using
reference types feels more comfortable when it's easy to know
it won't be changed.

This isn't technical, but it feels somehow satifying the way
const propogates seemlessly through a well-designed interface.

When programming Python, the only constants I care about are
magic numbers and lookup tables defined at the top of a program
or outside the program. If there are enough of them I'll put them
in a module or class/namespace. They don't exist in interfaces,
so I don't think about them in that sense.

-- 
Neil Cerutti

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

Reply via email to