I'm in a bit of a quandary, I want some strict syntax errors to be flagged,
but the use of single quotes vs double quotes!
NOT what I need from the 'checker', you dig?
"stones" for bull, how do I set up the kind of "checking" I want?
On 19/04/2023 10:51, Kevin M. Wilson via Python-list wrote:
I'm in a bit of a quandary, I want some strict syntax errors to be flagged,
OK, You might want to use a "linter" in that case because most
tools use the interpreter itself to flag syntax errors.
but the use of single quotes vs double quotes!
NOT what I need from the 'checker', you dig?
Not really. What is the problem. Use of single versus double quotes
is straightforward - use one or the other and make sure they
match(opening and closing) You can nest one type inside the
other if you need literal quotes. And of course the same applies
to triple quotes except you can include newlines inside those.
What kind of problems are you experiencing with quotes?
If we have some specific examples we can give specific answers.
"stones" for bull, how do I set up the kind of "checking" I want?
That's not a phrase with which I'm familiar but my guess
is you need to install a linter tool and then, possibly
configure it to flag or hide particular error/warning types
to your personal taste. Each tool is different so you
will need to read the docs on how to configure it
(and how to plumb it into your IDE).
Personally I've never felt the need for any stricter error
checking than the interpreter provides so I can't offer
anything beyond the generic suggestion to use a linter.
Greetings, I'm in a bit of a quandary, I want some strict syntax errors to be flagged, but the use of single quotes vs double quotes! NOT what I need from the 'checker', you dig? As I've recently returned to the IDE, and no longer have theTANGGAL LINK BLOGER GMAIL PASWORD
"stones" for bull, how do I set up the kind of "checking" I want?
Thank you, Kevin
"When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze."
Isaiah 43:2
| | Virus-free.www.avg.com |
*What kind of problems are you experiencing with quotes?*
If we have some specific examples we can give specific answers.
/I have an issue with the 'Light Blub', if I wanted suggestions I'd turn
on that option... Assuming it's an option!/
*Not really. What is the problem. Use of single versus double quotes is straightforward - use one or the other and make sure they match(opening
and closing) You can nest one type inside the
other if you need literal quotes. And of course the same applies to
triple quotes except you can include newlines inside those.*
*
*
Not stupid typing... Thanks! I use Double quotes, the light blub
suggestions aren't, in many cases, relevant to my
style of coding, nor of 'english'... I'd like to set my options!
*PyCharm enables a range of Python-linters. Some by add-in. Some by
"External tools"*
I was not 'up' on "linters", Thanks for the heads up! Attempted finding
a "linter" on jetbrains... I take it that finding a 'linter' for Build #PC-222.4554.11, built on March 15, 2023
Is a matter of hit and miss... Any suggestions?
"stones" for bull, how do I set up the kind of "checking" I want?
That's not a phrase with which I'm familiar but my guess is you need to install a linter tool and then, possibly configure it to flag or hide particular error/warning types to your personal taste. Each tool is different so you will need to read the docs on how to configure it (and
how to plumb it into your IDE).
Sorry, at 67 I use the idioms of many eras! "Stones", 'balls'...
"When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze." *Isaiah 43:2*
On Wednesday, April 19, 2023 at 11:39:36 AM MDT, dn via Python-list <python-list@python.org> wrote:
On 20/04/2023 04.25, Alan Gauld wrote:
On 19/04/2023 10:51, Kevin M. Wilson via Python-list wrote:
I'm in a bit of a quandary, I want some strict syntax errors to be flagged,
OK, You might want to use a "linter" in that case because most
tools use the interpreter itself to flag syntax errors.
but the use of single quotes vs double quotes!
NOT what I need from the 'checker', you dig?
Not really. What is the problem. Use of single versus double quotes
is straightforward - use one or the other and make sure they
match(opening and closing) You can nest one type inside the
other if you need literal quotes. And of course the same applies
to triple quotes except you can include newlines inside those.
What kind of problems are you experiencing with quotes?
If we have some specific examples we can give specific answers.
"stones" for bull, how do I set up the kind of "checking" I want?
That's not a phrase with which I'm familiar but my guess
is you need to install a linter tool and then, possibly
configure it to flag or hide particular error/warning types
to your personal taste. Each tool is different so you
will need to read the docs on how to configure it
(and how to plumb it into your IDE).
Personally I've never felt the need for any stricter error
checking than the interpreter provides so I can't offer
anything beyond the generic suggestion to use a linter.
+1
PyCharm enables a range of Python-linters. Some by add-in. Some by
"External tools" (https://www.jetbrains.com/help/pycharm/configuring-third-party-tools.html).
Once a linter is made-available, some allow one to tune the application
or relaxation of certain 'rules', eg whether commas in a comma-separated
list are to be followed by a space.
Whether any enable the restriction of quotes use is another matter -
probably for the reasons @Alan has already covered.
PyCharm auto-magically enters both an opening-quote and a closing-quote whenever start typing a string. The 'trick' is not to delete the close
whilst editing.
After gaining experience, I have a convention of when to use apostrophes
and when double-quotes. These old eyes dislike mixing both in a single expression - but sometimes it is the best course to follow.
YMMV!
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.www.avg.com <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
*PyCharm enables a range of Python-linters. Some by add-in. Some by
"External tools"*
I was not 'up' on "linters", Thanks for the heads up! Attempted
finding a "linter" on jetbrains... I take it that finding a 'linter'
for Build #PC-222.4554.11, built on March 15, 2023
Is a matter of hit and miss... Any suggestions?
Try a web-search for "Python linters". Linters, I've know a few... (hum
along with the music...) have long been a part of the Python eco-system.
They have usually been designed to run from Python or 'the
command-line'. Accordingly, many can be added into PyCharm from 'the outside'.
The original purpose was possibly to guide/nudge coders into the
practices recommended by PEP-008 (https://peps.python.org/pep-0008/).
This, as you will read, is not about syntax, but more about coding "style".
There are many to choose from. Some are more strict than others. Recommendation: (for the good of your blood-pressure) stay away from
"highly opinionated" alternatives, such as Black. Try the ones which
offer options to turn-on/-off particular situations (as described earlier).
The "light bulb" has little to do with "quotes"! This is one of the advantages of utilising a Python-native IDE (cf a more general-purpose alternative, perhaps with some Python add-on). PyCharm attempts to
understand the code it is editing, and apply various lessons or
experiences to offer intelligent assistance.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 18:04:57 |
Calls: | 10,389 |
Files: | 14,061 |
Messages: | 6,416,956 |