Define functions with too many arguments to abide by PEP8 standard

An example is given in PEP 8: class Rectangle(Blob): def __init__(self, width, height, color=”black”, emphasis=None, highlight=0): So that is the official answer. Personally I detest this approach, in which continuation lines have leading whitespace that doesn’t correspond to any real indentation level. My approach would be: class Rectangle(Blob): def __init__( self, width, height, color=”black”, emphasis=None, … Read more

Line continuation for list comprehensions or generator expressions in python

[x for x in (1,2,3) ] works fine, so you can pretty much do as you please. I’d personally prefer [something_that_is_pretty_long for something_that_is_pretty_long in somethings_that_are_pretty_long] The reason why \ isn’t appreciated very much is that it appears at the end of a line, where it either doesn’t stand out or needs extra padding, which has … Read more

PEP 8, why no spaces around ‘=’ in keyword argument or a default parameter value?

I guess that it is because a keyword argument is essentially different than a variable assignment. For example, there is plenty of code like this: kw1 = some_value kw2 = some_value kw3 = some_value some_func( 1, 2, kw1=kw1, kw2=kw2, kw3=kw3) As you see, it makes complete sense to assign a variable to a keyword argument … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)