News for hackers. Stuff that matters.
Re:Go 1.11 got me to stop ignoring Go by symmitchry on Tuesday October 09, 2018 @03:20PM (#18179014)
> I have major gripes with PEP-8, and if you ever see me using it I want you to shoot me in the face.

That sounds extreme. I've never heard this before. Why?

Re:Go 1.11 got me to stop ignoring Go by weberc2 on Tuesday October 09, 2018 @03:28PM (#18179077)
IIRC, pep8 would have you write:

    def my_very_very_very_very_very_long_function_name(self,
                                                       param1,
                                                       param2):
Re:Go 1.11 got me to stop ignoring Go by scott_s on Tuesday October 09, 2018 @03:37PM (#18179155)
Looking at it (https://www.python.org/dev/peps/pep-0008/), that is one of the options, but you could also do:

  def my_very_very_very_very_very_long_function_name(
          self, param1, 
          param2):
      pass
Shrug. Seems okay to me, and preferable to what they say no to.
Re:Go 1.11 got me to stop ignoring Go by Franciscouzo on Tuesday October 09, 2018 @03:36PM (#18179148)
You can choose to use:

    def my_very_very_very_very_very_long_function_name(
            self, param1, param2):
        ...
Re:Go 1.11 got me to stop ignoring Go by weberc2 on Tuesday October 09, 2018 @03:41PM (#18179195)
Ah, my mistake.
Re:Go 1.11 got me to stop ignoring Go by rand_r on Tuesday October 09, 2018 @03:46PM (#18179228)
My preference is to do this, which I think is quite nice and easy to work with:

    def my_very_very_very_very_very_long_function_name(
            self,
            param1,
            param2,
            ):
        do_it()  # function body here.
Re:Go 1.11 got me to stop ignoring Go by blueprint on Tuesday October 09, 2018 @03:59PM (#18179342)
Yup this. It works perhaps even more nicely in languages that have braces and return types, e.g.

    func some_name(
        arg: Type,
        arg2: Type
    ) -> RetVal {
        …
    }
Re:Go 1.11 got me to stop ignoring Go by dguaraglia on Tuesday October 09, 2018 @04:17PM (#18179466)
Yep, this is by far my least favorite autopep8 "correction".
Re:Go 1.11 got me to stop ignoring Go by baby on Thursday October 11, 2018 @06:23AM (#18192262)
if your function name is that long, you have a problem
Re:Go 1.11 got me to stop ignoring Go by gumballhead on Tuesday October 09, 2018 @03:43PM (#18179203)
I have major gripes with it too and don't use it unless a project enforces it.

The main ones that get me are the whitespace (4 characters) and restrictive line length (79 characters) rules. They don't work well together, and also don't work well with python's significant whitespace (can't easily break up a line), namespaces, generator expressions, and type hints. All for a subjective formatting decision.

I'll also often see people trying to cram as much as they can into 79 characters with one letter variable names and such while calling that elegant code because it's a "one-liner."

Re:Go 1.11 got me to stop ignoring Go by raverbashing on Tuesday October 09, 2018 @03:58PM (#18179335)
Yes, the 79 character limit gets in my nerves. Unless you're using a machine built in the 70s or 80s, this limit is complete BS

To be honest it says right at the beginning of PEP-8 that "A Foolish Consistency is the Hobgoblin of Little Minds" but it seems little minds are the norm (and usage of 'pep8' package to make developers do what a computer could do faster and better)

Re:Go 1.11 got me to stop ignoring Go by was_boring on Tuesday October 09, 2018 @04:21PM (#18179499)
I don't see many projects enforcing a line length, and if they do it's generally set much higher (120-150).
Re:Go 1.11 got me to stop ignoring Go by nine_k on Tuesday October 09, 2018 @03:33PM (#18179124)
PEP-8, to quote it [1], says in its first sentence:

> This document gives coding conventions for the Python code comprising the standard library in the main Python distribution.

If you are not writing Python's stdlib, you are free to not to stick to it.

If in doubt, the next section of the document is helpfully titled "A Foolish Consistency is the Hobgoblin of Little Minds".

[1]: https://www.python.org/dev/peps/pep-0008/