Created
December 12, 2011 12:22
-
-
Save dketov/1466907 to your computer and use it in GitHub Desktop.
Операторы и инструкции
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
""" | |
Приоритет операторов | |
""" | |
#--+--------------------+------------------------ | |
# | Operator | Description | |
#--+--------------------+------------------------ | |
# lambda | Lambda Expression | |
# or | Boolean OR | |
# and | Boolean AND | |
# not x | Boolean NOT | |
# in, not in | Membership tests | |
# is, is not | Identity tests | |
# <, <=, >, >=, !=, ==| Comparisons | |
# | | Bitwise OR | |
# ^ | Bitwise XOR | |
# & | Bitwise AND | |
# <<, >> | Shifts | |
# +, - | Addition and subtraction | |
# *, /, % | Multiplication, Division and Remainder | |
# +x, -x | Positive, Negative | |
# ~x | Bitwise NOT | |
# ** | Exponentiation | |
# x.attribute | Attribute reference | |
# x[index] | Subscription | |
# x[index:index] | Slicing | |
# f(arguments ...) | Function call | |
# (expressions, ...) | Binding or tuple display | |
# [expressions, ...] | List display | |
# {key:datum, ...} | Dictionary display | |
# 'expressions, ... | String conversion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
""" | |
Инструкции | |
""" | |
a = 0 | |
b = 1 | |
c = 2 | |
d = 3 | |
e = 4 | |
f = 5 | |
g = 6 | |
if a == b and c == d and \ | |
d == e and f == g: | |
print 'olde' # backslashes allow continuations | |
if (a == b and c == d and | |
d == e and e == f): | |
print 'new' # but parentheses usually do too | |
print "Here" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment