Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to overload logical and in Python?

I was under the impression it was possible to overload and in Python, but reading through the docs just now, I realized that __and__ refers to the bitwise & operator, not logical and.

Am I overlooking something, or is it not possible to overload logical and in Python?

like image 552
ArtOfWarfare Avatar asked Aug 31 '15 12:08

ArtOfWarfare


2 Answers

No this is not possible. There is a proposal that adds this functionality but for now, it is rejected.

like image 140
Salailah Avatar answered Oct 10 '22 18:10

Salailah


No, it is not possible. See here.

like image 20
rkrzr Avatar answered Oct 10 '22 18:10

rkrzr