Example:
Code: Select all
Gui.runCommand('Draft_Line',0)
Code: Select all
Gui.runCommand("Draft_Line", 0)
There is also this:
Code: Select all
>>> str = "abc"
>>> str
'abc'
Code: Select all
Gui.runCommand('Draft_Line',0)
Code: Select all
Gui.runCommand("Draft_Line", 0)
Code: Select all
>>> str = "abc"
>>> str
'abc'
It's partly wrong. Then true ideally a file (if possible a project) should be consistent.Roy_043 wrote: ↑Fri Jan 28, 2022 10:22 am Then I don't understand this comment:
https://github.com/FreeCAD/FreeCAD/pull ... r792673896
Code: Select all
print("this is a 'sting'")
or
print('this is a "string" ')
Code: Select all
# noqa
FreeCAD is mostly coded in C++, and many of the most important libraries that we use are also C++ (OCC, Qt). Therefore, I don't see why we should follow Python coding styles.
Maybe not very precise:Zolko wrote: ↑Fri Jan 28, 2022 11:26 am FreeCAD is mostly coded in C++, and many of the most important libraries that we use are also C++ (OCC, Qt). Therefore, I don't see why we should follow Python coding styles.
A big example is the naming of functions: riceCooker() or RiceCooker() or rice_cooker() . pep8 would mandate rice_cooker() but OCC and Qt already use riceCooker() everywhere, therefore I find it much more elegant and user-friendly to follow a single coding style inside FreeCAD : C++ style riceCooker().
Black prefers double quotes (" and """) over single quotes (' and '''). It will replace the latter with the former as long as it does not result in more backslash escapes than before.
Not that I have any feelings about it. But, I recently watched a tutorial on strings from Socratica in their Python series.chennes wrote: ↑Fri Jan 28, 2022 3:50 pm Speaking for myself, I really only care about consistency here, I don't have a strong feeling about single- versus double quotes. The lines in question actually had both on them, and I think we should pick one. As a fan of the Black code reformatter in my own code I standardize on double quotes in most cases, but as far as I'm concerned, as long as the code uses one or the other I'm happy to merge it.
Here's what Black has to say about it:Black prefers double quotes (" and """) over single quotes (' and '''). It will replace the latter with the former as long as it does not result in more backslash escapes than before.
That level of consistency is probably a pipe dream. In almost all Draft files there is a mix of both single and double quotes, sometimes, as in the example, even on the same line. This is even the case with files that have recently been refactored by a PEP8 advocate (who sometimes took PEP8 a bit too far IMO).