Question mark in variable and function names
Istvan Albert
ialbert at mailblocks.com
Wed Oct 6 13:53:20 EDT 2004
Alex Martelli wrote:
> Ruby has this convention and it seems to work wonderfully well for them.
I have used Ruby before switching to Python and I found
the ! symbol to be quite unhelpful. I don't recall the
exact syntax properly, what I remember is having something like
line.strip()
returning the stripped line while
line.strip!()
stripping the line in place.
What this meant that there were a bunch of methods now
with two distinct behaviors. The possibilities to foul up just
doubled. Basically I found myself sticking to one behavior
and using that consistently so that I did not have to
make an extra effort to double check the symbol at the end.
I find it much simpler if there is only one behavior, it either mutates
the input or it doesn't, one that makes the most sense
(as it is usually with python).
Istvan.
More information about the Python-list
mailing list