Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is python's not? A special function type?

In R, ! is really an infix operator `!`, so statements like

Map(`!`,c(T,F,F))

are totally valid. Is there a way to access the first order object underlying not in Python? I have been googling with no success.

like image 297
Carbon Avatar asked Jun 05 '15 20:06

Carbon


1 Answers

Python has the operator module, which includes a operator.not_() function:

import operator

map(operator.not_, (True, False, False))

not itself is one of the boolean operators.

like image 196
Martijn Pieters Avatar answered Oct 05 '22 10:10

Martijn Pieters