Hi Bruno,

On 3/25/24 5:00 AM, Bruno Haible wrote:
> - Your ability to work with misnamed variables is amazing. But
>   nonetheless let's make an effort to find better names :)

LOL, I appreciate the compliment, but yes I agree better naming is good.

> - Python has enough string processing primitives that we don't need
>   to write conditional expressions like
>     line if not line.endswith('\n') else line[:-1]
> 
>   (I also tried to move the removal of the newlines into the readlines()
>   invocation, but that does not work:
>   https://github.com/python/cpython/issues/52876 )

Usually I use str.[lr]strip() with no parameters which just cleans all
the whitespace. I completely forgot you could just do
line.rstrip('\n') there... Sorry about that.

I also tried to remove the newlines in readlines(), but I couldn't
figure it out... Hopefully that issue will get resolved because I feel
like there should be some way to do it automatically.

Collin

Reply via email to