首页 > 解决方案 > What is the difference between - and --- operators?

问题描述

I'm learning Python and in my book author uses --- operator in arithmetic operations and I can't find in google or SoF what is the difference between

>>> 5 - 2
3

and

>>> 5 --- 2
3

Update: Yeah, I understand why you all are downvoting this, but I just thought that may be some python specific, which is apparently not.

The book I found this is pretty good one actually - Python Journeyman by Robert Smallshire so I will assume it is just an error in the book.

标签: pythonpython-3.x

解决方案


主要区别在于后者不存在。然而,一元-二元-都有,所以表达式是简单的5 - (- (- 2))


推荐阅读