Yeah! Heated discussions! Tabs vs. Spaces. I am also full in for consistency. I think where there are no clear arguments to do this or that, for me consistency trumps any individual preference/style (especially when it is backed with automation that will correct things for you and will not put any extra burden on maintainers having to control it). One of my friends in Poland had the rather vulgar saying "Lepiej ch..o ale jednakowo" (Those who know, will know) - very free translation is "Better sh..ty but consistently" and I fully agree with it.
Happy to adapt to any style as long as I don't even have to think about it and my personal preferences are not important here. J. On Wed, Sep 21, 2022 at 9:03 AM Bartłomiej Hirsz <bartek.hi...@gmail.com> wrote: > The formatting discussions are always the most heated ones :) I'm for > normalization - we have ugly mix of both and I'm down for whatever but to > be consistent. I wouldn't worry about git history or cherry picks. We had > several PRs recently that touched almost every file anyway (like improving > our imports). And number of changes per file doesn't matter since later it > will be handled by precommit before adding your new code anyway. > > Regarding replacing "string with '" to 'string with "' - this cannot be > done automatically because in many cases it was done deliberately. For > example, if someone wants to write an English sentence: "It'll go nicely". > The (ugly) solution for this, if someone would really want to use one type > of quote marks, would be using triple single quota for such cases. > > śr., 21 wrz 2022 o 08:54 Pankaj Koti <pankaj.k...@astronomer.io.invalid> > napisał(a): > >> Correction in my previous email. pre-commit hook >> double-quote-string-fixer too does not seem to work well for f-strings with >> a mix of double and single quotes (meaning does not convert a f-string >> which has outer quotes as double and inner quotes as single). It just skips >> it if the string is like the below: >> f"hello how are you, my name is 'Pankaj', I hope you're well" >> >> >> Regards, >> >> >> >> Pankaj Koti >> >> *Senior Software Engineer, *OSS Engineering Team. >> Location: Pune, India >> >> Timezone: Indian Standard Time (IST) >> >> Email: pankaj.k...@astronomer.io >> >> Mobile: +91 9730079985 >> >> >> On Wed, Sep 21, 2022 at 12:15 PM Jeambrun Pierre <pierrejb...@gmail.com> >> wrote: >> >>> Definitely in favor of more consistency. (Hoping it will not make things >>> too hard for people doing the cherry picking) >>> >>> Best Regards, >>> Pierre >>> >>> Le mer. 21 sept. 2022 à 08:35, Pankaj Koti >>> <pankaj.k...@astronomer.io.invalid> a écrit : >>> >>>> I'm in for normalizing. >>>> Personally, I don't like a mix of both single and double quotes. >>>> >>>> In my opinion, we can enforce double-quotes with Black or also try the >>>> pre-commit hook double-quote-string-fixer >>>> https://github.com/pre-commit/pre-commit-hooks/blob/main/README.md#double-quote-string-fixer >>>> which converts double quotes to single quotes. I believe the python >>>> community prefers single quotes over double in general ( >>>> https://github.com/psf/black/issues/373) so we can consider the latter >>>> option (double-quote-string-fixer pre-commit hook)? It normalizes f-strings >>>> too. >>>> >>>> >>>> Regards, >>>> >>>> >>>> >>>> Pankaj Koti >>>> >>>> *Senior Software Engineer, *OSS Engineering Team. >>>> Location: Pune, India >>>> >>>> Timezone: Indian Standard Time (IST) >>>> >>>> Email: pankaj.k...@astronomer.io >>>> >>>> Mobile: +91 9730079985 >>>> >>>> >>>> On Wed, Sep 21, 2022 at 11:22 AM Felix Uellendall >>>> <felue...@pm.me.invalid> wrote: >>>> >>>>> Totally for it! >>>>> >>>>> That’s not true actually. Black won’t reformat strings using f-string >>>>> if you use single quotes for the string and double quotes within e.g. >>>>> when passing a str.join statement as a value which uses double quotes. So >>>>> you can still have a mixture of both in the codebase but it will be less. >>>>> :) >>>>> (I would have expected black to reformat this and turn the f-string >>>>> quotes into double quotes and single quotes within, but it is a difficult >>>>> decision.) >>>>> >>>>> Best, >>>>> Felix >>>>> >>>>> >>>>> >>>>> Sent from Proton Mail for iOS >>>>> >>>>> >>>>> On Wed, Sep 21, 2022 at 06:19, Daniel Standish < >>>>> daniel.stand...@astronomer.io.INVALID> wrote: >>>>> >>>>> I'll weigh in on this most important of decisions >>>>> >>>>> >>>>> :) >>>>> >>>>> OK but I must clear up one thing ... if we turn on string >>>>> normalization, we do not get to choose single vs double -- with black, >>>>> there is only one way, and it is double. >>>>> >>>>> Personally I have always liked single but yeah, I am in favor of >>>>> turning on normalization, which means double (generally speaking). Black >>>>> explains the reasoning for the choice here >>>>> <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings> >>>>> . >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>