__pychecker__ = 'no-callinit no-classattr'
pychecker -- help
def foo(a, unused_b, unused_c, d=None, e=None): _ = d, e return a
from sound.effects import echo ... echo.EchoFilter(input, output, delay=0.7, atten=4)
# import sound.effects.echo # () from sound.effects import echo
class Error(Exception): pass
try: raise Error except Error as error: pass
result = [] for x in range(10): for y in range(5): if x * y > 10: result.append((x, y)) for x in xrange(5): for y in xrange(5): if x != y: for z in xrange(5): if y != z: yield (x, y, z) return ((x, complicated_transform(x)) for x in long_generator_function(parameter) if x is not None) squares = [x * x for x in range(10)] eat(jelly_bean for jelly_bean in jelly_beans if jelly_bean.color == 'black')
result = [(x, y) for x in range(10) for y in range(5) if x * y > 10] return ((x, y, z) for x in xrange(5) for y in xrange(5) if x != y for z in xrange(5) if y != z)
for key in adict: ... if key not in adict: ... if obj in alist: ... for line in afile: ... for k, v in dict.iteritems(): ...
for key in adict.keys(): ... if not adict.has_key(key): ... for line in afile.readlines(): ...
def foo(a, b=None): if b is None: b = []
def foo(a, b=[]):
def foo(a, b=1): ...
foo(1) foo(1, b=2)
foo(1, 2)
import math class Square(object): """A square with two properties: a writable area and a read-only perimeter. To use: >>> sq = Square(3) >>> sq.area 9 >>> sq.perimeter 12 >>> sq.area = 16 >>> sq.side 4 >>> sq.perimeter 16 """ def __init__(self, side): self.side = side def __get_area(self): """Calculates the 'area' property.""" return self.side ** 2 def ___get_area(self): """Indirect accessor for 'area' property.""" return self.__get_area() def __set_area(self, area): """Sets the 'area' property.""" self.side = math.sqrt(area) def ___set_area(self, area): """Indirect setter for 'area' property.""" self.__set_area(area) area = property(___get_area, ___set_area, doc="""Gets or sets the area of the square.""") @property def perimeter(self): return self.side * 4
if not users: print "no" if foo == 0: self.handle_zero() if i % 10 == 0: self.handle_multiple_of_ten()
if len(users) == 0: print 'no users' if foo is not None and not foo: self.handle_zero() if not i % 10: self.handle_multiple_of_ten()
words = foo.split(':') [x[1] for x in my_list if x[2] == 5] map(math.sqrt, data) # - fn(*args, **kwargs)
words = string.split(foo, ':') map(lambda x: x[1], filter(lambda x: x[2] == 5, my_list))
def get_adder(summand1): """Returns a function that adds numbers to a given number.""" def adder(summand2): return summand1 + summand2 return adder
i = 4 def foo(x): def bar(): print i, # ... # # ... for i in x: # , i Foo, - Bar . print i, bar()
Source: https://habr.com/ru/post/179271/