5 ms·
> 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?
by symmitchry 8y ago
> 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?
- weberc2 8y agoIIRC, pep8 would have you write: def my_very_very_very_very_very_long_function_name(self, param1, param2):
- Franciscouzo 8y agoYou can choose to use: def my_very_very_very_very_very_long_function_name( self, param1, param2): ...
- weberc2 8y agoAh, my mistake.
- scott_s 8y agoLooking at it (https://www.python.org/dev/peps/pep-0008/ 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.
- rand_r 8y agoMy 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.
- blueprint 8y agoYup 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 { … }
- dguaraglia 8y agoYep, this is by far my least favorite autopep8 "correction".
- baby 8y agoif your function name is that long, you have a problem
- nine_k 8y agoPEP-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/ https://www.python.org/dev/peps/pep-0008/
- gumballhead 8y agoI 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."
- raverbashing 8y agoYes, 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)
- was_boring 8y agoI don't see many projects enforcing a line length, and if they do it's generally set much higher (120-150).