Defining Python Operators: A List -
Defining Python Operators: A List -
in learn python hard way zed shaw there list of operators weren't defined given exercise, , i've had problem trying find definition / purpose around web.
here's have far:
+ : addition/concatenation - : subtraction * : multiplication ** : exponenttiation / : partition // : floor partition :: digits after decimal place removed % : string type flag? < : less > : greater <= : less / equal >= : greater / equal == : absolute equality != : not equal <> : old not equal -- apparently phased out, utilize above != () : ________________________ [] : ________________________ {} : ________________________ @ : decorators, maybe matrix multiplication in 3.5 future release ' : ________________________ : : ________________________ . : used modifying/linking element property/subproperty = : equality ; : ________________________ += : duality in operation, successively :: x = x + 1 >> x += 1 -= : " " :: x = x - 1 >> x -= 1 *= : " " :: x = x * 1 >> x *= 1 /= : " " :: x = x / 1 >> x /= 1 //= : floor partition , assigns value, performs floor partition on operators , assign value left operand %= : modulus , assignment operator, takes modulus using 2 operands , assign result left operand : c%=a == c = c % **= : exponent , assignment operator: performs exponential (power) calculation on operators , assigns value left operand : c **= == c ** , c exponent of
i'm sure these definitions aren't finish , they're poorly worded, if want create corrections previous definitions, means, i'm trying figure out ones have yet complete--there blank lines above
links i've attempted with: python operators 1 || python operators 2 || python 3.0 operators || 2.7.7 operator precedence ||
%
modulus. 3 % 2 == 1
. can utilize when formatting strings though, operator, modulus. formatting strings, mystring.format() preferred.
()
either function call, or order of precedence in general expressions. f(x)
, example, or (3 * (1 + 2))
. calls __call__
method of object. creates tuple literal, if there @ to the lowest degree 1 comma in tuple. (4,)
example.
[]
indexing - allows select container index via __getitem__
, __setitem__
methods. [1,2,3,4,5,6][2] == 3
. creates list.
{}
constructs either set or dictionary, depending on context.
@
used decorators, not matrix multiplication.
'
quote , equivalent "
:
used list slicing, , denote code block. (such in function, error handling context or loop)
;
not used unless want set multiple statements on 1 line, isn't encouraged readability purposes.
other that, think have definitions more-or-less correct.
python operators
Comments
Post a Comment