Skip to content

Instantly share code, notes, and snippets.

@dketov
Created December 12, 2011 12:22
Show Gist options
  • Save dketov/1466907 to your computer and use it in GitHub Desktop.
Save dketov/1466907 to your computer and use it in GitHub Desktop.
Операторы и инструкции
# -*- 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
# -*- 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