Earlier quoted context omitted.
I’m a Python programmer and I never had the perception that single quotes are more canonical in any capacity. I always felt that single quotes were for degenerates who didn’t realize that single quotes are most commonly used for chars by the broader programming community. ;)
I despise people using single quotes even more than people using tabs instead of space, emacs instead of vim or GNU-style indentation instead of... anything sane :D
Black: An uncompromising Python code formatter
231–240 of 262 posts
Re: Black: An uncompromising Python code formatter
#232Earlier quoted context omitted.
I’m a Python programmer and I never had the perception that single quotes are more canonical in any capacity. I always felt that single quotes were for degenerates who didn’t realize that single quotes are most commonly used for chars by the broader programming community. ;)
I despise people using single quotes even more than people using tabs instead of space, emacs instead of vim or GNU-style indentation instead of... anything sane :D
Re: Black: An uncompromising Python code formatter
#233Earlier quoted context omitted.
I’m a Python programmer and I never had the perception that single quotes are more canonical in any capacity. I always felt that single quotes were for degenerates who didn’t realize that single quotes are most commonly used for chars by the broader programming community. ;)
I’ve always thought that double quotes are for degenerates who don’t pay attention to what a standard repr output is for strings.
Re: Black: An uncompromising Python code formatter
#234Earlier quoted context omitted.
I’ve always thought that double quotes are for degenerates who don’t pay attention to what a standard repr output is for strings.
And I’ve always thought that triple quotes are for degenerates who... no, wait, nvm.
Re: Black: An uncompromising Python code formatter
#235Re: Black: An uncompromising Python code formatter
#236Earlier quoted context omitted.
Sure you can prefer this but it is not the point. The point is that having ONE average way to do it > several best ways for several people.
I'm saying this is a weird/below-average way to do it. If this cannot fit in one line: foo(arg1, arg2) My first choice would be: foo( arg1, arg2, ) Second choice would be: foo( arg1, arg2, ) While Black chooses: foo( arg1, arg2 ) And made some unconvincing argument about it: > Unnecessary trailing commas are removed if an expression fits in one line. This makes it 1% more likely that your line won't exceed the allott…
Re: Black: An uncompromising Python code formatter
#237I really want to use Black, but we have a particular style point that we’d miss so much that we haven’t adopted it yet... Double quotes for strings that need to be human readable, single quotes otherwise. This makes it so obvious when something is going to be sent to the user, we find it really useful. That said, I think Black’s appeal is it’s uncompromising nature, so I wouldn’t ask it to change. Adding the option t…
Why would you have strings that are not supposed to be human readable? Machine to machine should ideally use bytearray (b""-strings) or integer enums for that purpose. Then you also have the ambiguity of what is considered human readable, is an xml document human readable? Http headers? File paths? Urls? Is a programmer considered human?
Re: Black: An uncompromising Python code formatter
#238Earlier quoted context omitted.
That's the #1 complaint I have (and hear) about Black. Everything else, I can live with. And honestly, I can live with using double quotes everywhere, especially when I can type single quotes and then let it re-write them. It's just that they currently look really, really odd to me because that's not how Python is traditionally written.
I prefer a quoting convention of single quotes for text identifiers (as they rarely contain quotes) and double quotes for English text (because contractions are common). Thus: key['first_name'] print("Isn't this clearer?")
Adopted that from Erlang, where atoms are single-quoted and text strings are double-quoted.
Re: Black: An uncompromising Python code formatter
#239Earlier quoted context omitted.
Do you find your team enforcing the string quote rule consistently? It seems to me like it's easy to miss at times as automatic enforcement is impossible. Are there no cases where a string that wasn't originally planned to be user-visible ends up being so? I've heard this idea at times but when I looked at actual codebases it turns out it's more of an aspiration than an actual rule. And if you can't depend on it, why…
> And if you can't depend on it, why have it? That's a bit rich. There are other conventions in programming that you can't depend on technically but serve a real purpose. Identifier naming and comments are the first that come to mind. If a language gives you a choice of token that has no semantic distinction then different people will adopt different semantics by convention. As an aside, calling a tool "opinionated"…
Re: Black: An uncompromising Python code formatter
#240Earlier quoted context omitted.
And I’ve always thought that triple quotes are for degenerates who... no, wait, nvm.
... who can’t write self-explanatory code.
I get your specific comment may be a bit sarcastic, given the ancestry - but I make this one more for younger developers I see that don’t always filter that ;)