On Tue, 03 Jul 2018 07:52:42 +0400, Abdur-Rahmaan Janhangeer wrote:

> .replace("a" or "b")


Oh I *wish* Python accepted that syntax to mean what you thought it meant.

That's a common error: a surprising number of beginners are fooled by how 
close Python is to natural language and try writing things like:


   if x == 1 or 2:
       ...



Reading Python is sometimes close to reading English, but not *that* 
close.

There is currently no way to tell str.replace to replace "either this, or 
that".


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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

Reply via email to