• PyCharm's strict PEP and not so strict?

    From Kevin M. Wilson@21:1/5 to All on Wed Apr 19 09:51:24 2023
    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 the
    "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 |

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alan Gauld@21:1/5 to Kevin M. Wilson via Python-list on Wed Apr 19 17:25:37 2023
    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.

    --
    Alan G
    Author of the Learn to Program web site
    http://www.alan-g.me.uk/
    http://www.amazon.com/author/alan_gauld
    Follow my photo-blog on Flickr at:
    http://www.flickr.com/photos/alangauldphotos

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dn@21:1/5 to Alan Gauld on Thu Apr 20 05:37:33 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From risky sibam@21:1/5 to All on Wed Apr 19 12:58:37 2023
    TANGGAL LINK BLOGER GMAIL PASWORD
    (( https://www.blogger.com/ ))
    08/04/2023 https://slotmomo99.blogspot.com/
    16/04/2023 https://slotmomo99.blogspot.com/2023/04/slot88-slot-resmi-gacor-mudah-menang.html
    16/04/2023 https://slot88maxwinn.blogspot.com/
    16/04/2023 https://slot88maxwinn.blogspot.com/2023/04/daftar-situs-judi-slot88-paling-gacor.html
    17/04/2023 https://slotmomo99.blogspot.com/2023/04/slot88-menyediakan-slot-gacor-maxwin.html
    17/04/2023 https://slot88maxwinn.blogspot.com/2023/04/situs-slot-gacor-gampang-menang-maxwin.html
    17/04/2023 https://momo99slotgacor.blogspot.com/
    17/04/2023 https://momo99slotgacor.blogspot.com/2023/04/s.html
    17/04/2023 https://momo99a.blogspot.com/
    17/04/2023 https://momo99a.blogspot.com/2023/04/daftar-link-situs-slot-gacor-maxwin.html
    17/04/2023 https://momo99d.blogspot.com/
    17/04/2023 https://momo99d.blogspot.com/2023/04/daftar-slot-online-slot-gacor-terbaru.html
    17/04/2023 https://momo99f.blogspot.com/
    17/04/2023 https://momo99f.blogspot.com/2023/04/daftar-situs-slot-gacor-deposit-pulsa.html
    18/04/2023 https://momo99g.blogspot.com/
    18/04/2023 https://momo99g.blogspot.com/2023/04/judi-situs-slot-deposit-pulsa-10-ribu.html
    18/04/2023 https://slotdana999.blogspot.com/
    18/04/2023 https://slotdana999.blogspot.com/2023/04/daftar-situs-judi-slot-online-deposit.html
    18/04/2023 https://slotpulsamomo99.blogspot.com/
    18/04/2023 https://slotpulsamomo99.blogspot.com/2023/04/slotpulsa-daftar-situs-slot-gacor.html
    19/04/2023 https://slotgacorpulsa77.blogspot.com/
    19/04/2023 https://slotgacorpulsa77.blogspot.com/2023/04/slot-gacor-deposit%20pulsa.html
    19/04/2023 https://slotthailand88.blogspot.com/
    19/04/2023 https://slotthailand88.blogspot.com/2023/04/slot-thailand-situs-judi-slot-gacor.html
    19/04/2023 https://slotpragmaticplay888.blogspot.com/ 19/04/2023 https://slotpragmaticplay888.blogspot.com/2023/04/daftar-situs-resmi-pragmatic-play.html


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From risky sibam@21:1/5 to All on Wed Apr 19 12:57:43 2023
    Pada Rabu, 19 April 2023 pukul 23.10.31 UTC+7, Kevin M. Wilson menulis:
    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 the
    "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 |
    TANGGAL LINK BLOGER GMAIL PASWORD
    (( https://www.blogger.com/ ))
    08/04/2023 https://slotmomo99.blogspot.com/
    16/04/2023 https://slotmomo99.blogspot.com/2023/04/slot88-slot-resmi-gacor-mudah-menang.html
    16/04/2023 https://slot88maxwinn.blogspot.com/
    16/04/2023 https://slot88maxwinn.blogspot.com/2023/04/daftar-situs-judi-slot88-paling-gacor.html
    17/04/2023 https://slotmomo99.blogspot.com/2023/04/slot88-menyediakan-slot-gacor-maxwin.html
    17/04/2023 https://slot88maxwinn.blogspot.com/2023/04/situs-slot-gacor-gampang-menang-maxwin.html
    17/04/2023 https://momo99slotgacor.blogspot.com/
    17/04/2023 https://momo99slotgacor.blogspot.com/2023/04/s.html
    17/04/2023 https://momo99a.blogspot.com/
    17/04/2023 https://momo99a.blogspot.com/2023/04/daftar-link-situs-slot-gacor-maxwin.html
    17/04/2023 https://momo99d.blogspot.com/
    17/04/2023 https://momo99d.blogspot.com/2023/04/daftar-slot-online-slot-gacor-terbaru.html
    17/04/2023 https://momo99f.blogspot.com/
    17/04/2023 https://momo99f.blogspot.com/2023/04/daftar-situs-slot-gacor-deposit-pulsa.html
    18/04/2023 https://momo99g.blogspot.com/
    18/04/2023 https://momo99g.blogspot.com/2023/04/judi-situs-slot-deposit-pulsa-10-ribu.html
    18/04/2023 https://slotdana999.blogspot.com/
    18/04/2023 https://slotdana999.blogspot.com/2023/04/daftar-situs-judi-slot-online-deposit.html
    18/04/2023 https://slotpulsamomo99.blogspot.com/
    18/04/2023 https://slotpulsamomo99.blogspot.com/2023/04/slotpulsa-daftar-situs-slot-gacor.html
    19/04/2023 https://slotgacorpulsa77.blogspot.com/
    19/04/2023 https://slotgacorpulsa77.blogspot.com/2023/04/slot-gacor-deposit%20pulsa.html
    19/04/2023 https://slotthailand88.blogspot.com/
    19/04/2023 https://slotthailand88.blogspot.com/2023/04/slot-thailand-situs-judi-slot-gacor.html
    19/04/2023 https://slotpragmaticplay888.blogspot.com/ 19/04/2023 https://slotpragmaticplay888.blogspot.com/2023/04/daftar-situs-resmi-pragmatic-play.html


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dn@21:1/5 to Kevin M. Wilson on Thu Apr 20 11:19:43 2023
    NB this reply came only to me (so @Alan will have missed your response
    to his posting). Have replied on-list (only) - please see earlier
    comment about email-client behaviors...


    On 20/04/2023 08.11, Kevin M. Wilson wrote:
    *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!/

    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.

    Thus, the "light bulb" is an icon indicating that PyCharm had spotted
    one or more "intention actions". These may be faults in the code, or may
    be anticipating what you're about to do and offering to do it for you. A
    red light-bulb indicates that there is an error in the Python code.
    Whereas, the yellow color indicates opportunity, aka "a light-bulb
    moment". Hah!

    Yes, there are times when the icon overlays and obstructs the code, and
    thus irritates. I believe it can be turned-off (but don't recommend such
    to coders at your level of skill). Please read the manual, specifically
    that page
    (https://www.jetbrains.com/help/pycharm/intention-actions.html) -
    there's even an F-string code-example!

    In this case, PyCharm undoubtedly was picking-up that the string was
    opened by a single-quote but never closed. One of the useful options
    PyCharm suggests in this case, is to presume that the string is longer
    than will fit on one line, and it will 'break' the string for you/us and
    ensure that the correct punctuation is placed at the beginning and end
    of each fragment of the string - something many of us find either
    slightly confusing or a nuisance of 'boiler-plate'.

    To see what it has noticed, the alternative actions are to mouse-click
    on the light-bulb, or to type Alt+Enter. Interestingly, the latter is
    called "Show Context Actions" (but is still talking about "Intentions".
    The description reads "Quick-fixes for highlighted errors and warnings, intention actions for improving and optimizing your code." (https://www.jetbrains.com/help/pycharm/mastering-keyboard-shortcuts.html)

    You may have noticed some indicators/statistics at the top-right of the
    editing panel. Green ticks/check-marks, and amber/yellow or red caution-triangles. These similarly indicate problems PyCharm has
    noticed, or wisdom from which you may choose to benefit. These come from
    a feature called "inspection". There are some controls enabling
    adjustment of "inspection severity" (https://www.jetbrains.com/help/pycharm/configuring-inspection-severities.html) which may be worth the reading-time. However, and once again, changing
    any cannot be recommended to someone at an early stage of Python-experience.


    *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!

    Sadly this wouldn't help!

    If you (can) turn-off such warnings in PyCharm, it will simply delay the inevitable - when the code is executed Python will object to the opening
    of a single-quote and not finding its matching close.
    ie the issue is NOT with PyCharm (nor with Python) but ...


    *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).


    "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'...

    Let's try to dispute another old saw - the one about "old dogs"...
    Then there's "slowly, slowly, catchee..."
    (but all of these are probably regarded as 'politically incorrect', and anything disrespectful of others transgresses the Python Code of
    Conduct, so let's park 'the attitude' right there)

    @Alan is an accomplished author - even if more familiar with British
    slang, rather than Spanish 'translations'. This list is blessed by contributions from people from all around the globe. Accordingly,
    there'll be many who are unable to understand your/my aphorisms and
    allusions. Hence trying to stay with a more 'international English'.


    "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>

    --
    Regards,
    =dn

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Passin@21:1/5 to dn via Python-list on Thu Apr 20 09:04:36 2023
    On 4/19/2023 7:19 PM, dn via Python-list wrote:

    *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).

    Be aware that most of these tools can be configured to be more or less
    fussy, but it's not going to be so easy for the uninitiated.
    Unconfigured, you will likely see a stream of messages that aren't
    helpful but may seem overwhelming. Once you have finally gotten one
    configured to your satisfaction, you probably will not need to change
    the configuration again for a long time.

    You can generally disable specific warnings at a point in the code with
    special comments. Using pylint, for example, perhaps appropriate in
    view of the OP's original post:

    # pylint: disable = consider-using-f-string

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mats Wichmann@21:1/5 to dn via Python-list on Thu Apr 20 10:23:49 2023
    On 4/19/23 17:19, dn via Python-list wrote:

    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.

    To nitpick a little bit, PyCharm isn't *exactly* Python-native, it's a derivative of the IntelliJ generic IDE platform (written in, sigh, Java)
    with a *very* evolved Python add-on and packaged in such a way as to
    make it look as if it weren't an addon at all (but if you lift the
    covers up you can see the roots)


    Builtin bits are very configurable, usually, but I haven't found that
    the Python code inspection (this is the stuff that by default gives you
    the PEP8-type warnings) is particularly so - be happy to stand corrected
    on that. However, you can configure an external tool - say, pylint - and
    if you do, you configure that in the normal way (a .pylintrc rcfile, or
    a toml config file). If you do this, you can turn off those style checks
    from the builtin checker. If you want.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)