Hot take: python is too verbose to have an 80-character line length standard while retaining the semantic readibility it promotes as a feature.
-
-
The purely-pandas version of doing this is no better, and is actually worse, as I can't specify the locale to sort characters properly.
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Sometimes it can be a very soothing task that helps me refactor, sometimes it makes me yearn for a lisplike where everything is moving in one direction. I do a lot of assignment for readability. Culturally in 2018 python is pseudo-functional but syntactically it's imperative.
-
I write python like a functional programmer and I can't decide if that makes me terrible or not
-
Actually I write it like a Rubyist who mostly wrote c#.
End of conversation
New conversation -
-
-
I’d break that in 4 (!!!) lines (new line after “sorted(“, new line after the first comma, new line before the last parenthesis), but you’re damn right that the 80 cols is just ridiculous, especially on the modern, large screens we have nowadays.
-
According to PEP-8 and the python specs, two of those line breaks wouldn't lead to a reduction in line length, just readability.
-
Well, I suppose delegating the final parents to a new line would save one char :P
End of conversation
New conversation -
-
-
Maybe I’ve just been writing too much clojure, but can you turn that list comprehension into a named function?
-
Probably, but it's a marginal tradeoff really. And stylistically, nothing is really great and all this exists only because pandas' sorting method is less general than builtin methods, so we have a smorgasboard of style concepts happening here.
-
For whatever reason I thought this would need to be a function but this can just be a named variable. I think making the list comprehension a named variable improves readability anyway, and is better than just going to 120 characters or whatever.
End of conversation
New conversation -
-
-
have you seen this talk from PyCon 2015? It touches on this and the distractions it causes, I really like it https://youtube.com/watch?v=wf-BqAjZb8M …
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I think this is why Pycharm defaults to nagging you at 120 chars instead of 80, despite Pep8
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
use 1 letter var names lol
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I think your python is beautiful. Dont change it
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I break generator expressions at "for" if necessary and at "if" almost as a rule.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Python is all over the road, but better than perl.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.