Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Nonsense. Space is blue and birds fly through it. -- Heisenberg


devel / comp.lang.python / Re: PyCharm's strict PEP and not so strict?

SubjectAuthor
o Re: PyCharm's strict PEP and not so strict?dn

1
Re: PyCharm's strict PEP and not so strict?

<mailman.132.1681946407.20750.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=27435&group=comp.lang.python#27435

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonList@DancesWithMice.info (dn)
Newsgroups: comp.lang.python
Subject: Re: PyCharm's strict PEP and not so strict?
Date: Thu, 20 Apr 2023 11:19:43 +1200
Organization: DWM
Lines: 209
Message-ID: <mailman.132.1681946407.20750.python-list@python.org>
References: <2110321349.5908606.1681897884162.ref@mail.yahoo.com>
<2110321349.5908606.1681897884162@mail.yahoo.com>
<b36efc8f-7fcf-e646-57e1-1f008d8f719a@yahoo.co.uk>
<06af8d39-a128-27e6-eeb8-f9e3f8fde7b6@DancesWithMice.info>
<692943468.6227351.1681935070220@mail.yahoo.com>
<949d6719-a06b-6dcf-9aa5-6d6497c38060@DancesWithMice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de maIz3zAQR4IV5fIik92htgtSFyRD4LliuD2c9/5qd69g==
Return-Path: <PythonList@DancesWithMice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=DlvMcrLG; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'pycharm': 0.04; '(for':
0.05; 'coders': 0.05; 'indicate': 0.05; 'url:webmail': 0.05;
'"python': 0.07; '2023': 0.07; 'matching': 0.07; 'string': 0.07;
'suggestion': 0.07; '=dn': 0.09; 'attempts': 0.09; 'delay': 0.09;
'expression': 0.09; 'eyes': 0.09; 'from:addr:danceswithmice.info':
0.09; 'from:addr:pythonlist': 0.09; 'intelligent': 0.09; 'ok,':
0.09; 'python)': 0.09; 'situations': 0.09; 'spanish': 0.09;
'subject:not': 0.09; 'those.': 0.09; 'url-ip:151.101.0.223/32':
0.09; 'url-ip:151.101.128.223/32': 0.09; 'url-
ip:151.101.192.223/32': 0.09; 'url-ip:151.101.64.223/32': 0.09;
'url:pycharm': 0.09; 'coding': 0.13; 'url:mailman': 0.15;
'problem.': 0.15; 'syntax': 0.15; '"show': 0.16; '(so': 0.16;
'*what': 0.16; 'applies': 0.16; 'assuming': 0.16; 'cases,': 0.16;
'code."': 0.16; 'coding,': 0.16; 'enabling': 0.16; 'executed':
0.16; 'flag': 0.16; 'gauld': 0.16; 'help!': 0.16; 'highlighted':
0.16; 'intention': 0.16; 'interpreter': 0.16; 'message-
id:@DancesWithMice.info': 0.16; 'missed': 0.16; 'quotes.': 0.16;
'received:51.254': 0.16; 'received:51.254.211': 0.16;
'received:51.254.211.219': 0.16; 'received:cloud': 0.16;
'received:rangi.cloud': 0.16; 'restriction': 0.16; 'sorry,': 0.16;
'subject:PyCharm': 0.16; 'subject:strict': 0.16; 'suggestions?':
0.16; 'syntax,': 0.16; 'typing': 0.16; 'url:jetbrains': 0.16;
'url:peps': 0.16; 'whilst': 0.16; 'wrote:': 0.16; 'python': 0.16;
'code.': 0.17; 'probably': 0.17; "can't": 0.17; 'to:addr:python-
list': 0.20; 'issue': 0.21; 'unable': 0.21; "i've": 0.22;
'install': 0.23; 'code': 0.23; 'run': 0.23; 'thanks!': 0.24;
"i'd": 0.24; '(and': 0.25; 'anything': 0.25; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'examples': 0.25; 'url:listinfo': 0.25; 'cannot': 0.25; 'url-
ip:188.166/16': 0.25; 'again,': 0.26; 'configure': 0.26; 'object':
0.26; 'opening': 0.26; 'practices': 0.26; 'wednesday,': 0.26; 'url
:sig-email': 0.27; 'bit': 0.27; 'old': 0.27; 'purpose': 0.28;
'suggestions': 0.28; 'error': 0.29; 'header:User-Agent:1': 0.30;
'url:link': 0.30; 'code,': 0.31; 'comment': 0.31; 'convention':
0.31; 'header:Organization:1': 0.31; 'url-ip:188/8': 0.31;
'advantages': 0.69; 'latter': 0.69; 'url:email-signature': 0.69;
'times': 0.69; 'you.': 0.71; 'offer': 0.71; 'longer': 0.71;
'little': 0.73; 'relevant': 0.73; 'tools': 0.74; 'read,': 0.75;
'reply': 0.77; 'park': 0.81; 'editing': 0.84; 'reasons': 0.84;
'"when': 0.84; 'adjustment': 0.84; 'aka': 0.84; 'benefit.': 0.84;
'black.': 0.84; 'bull,': 0.84; 'close.': 0.84; 'dispute': 0.84;
'editing.': 0.84; 'enters': 0.84; 'from.': 0.84; 'indicates':
0.84; 'optimizing': 0.84; 'quotes': 0.84; 'quotes,': 0.84;
'really.': 0.84; 'similarly': 0.84; 'stupid': 0.84; 'thus,': 0.84;
'tune': 0.84; 'you:': 0.84; 'blessed': 0.91; 'british': 0.91;
'heads': 0.91; 'punctuation': 0.91; 'line,': 0.93; 'green': 0.96
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 109833479
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1681946404;
bh=OxAosNhzj32xdum+q0ghXxjEoHdifZc2lNAziMvGvK8=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=DlvMcrLGUX0+NUO7zguflA1iULitG5Ba7cM1dmGMoFKxn2Z0Gh1kHcVr0jvHPfWub
fcbphuayuBG0wZDRXkmdc/svRwNkIPgqyGGc6nJhj6w3gkco2GsBwBEO9Rz9+s63vh
/1Kp+4LEsqi2xmd28It/zknALQiMDcElVzlNdT8fHEz/XX+bNCHbVnQw78vnhVmUYL
ATmFg4vZghqfChQiN73qehjpBtimg/7kq1PZSd+WJ2QeMpX764v3qR65S/svo8l4cM
pBw2NMu8ZWFzMi299zUPc+zEVZwHPFPHlF+Z1A7Vvs1NarFbgJeSaSewupijPYKcFR
n1x3YBYtD1wdg==
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Content-Language: en-GB
In-Reply-To: <692943468.6227351.1681935070220@mail.yahoo.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <949d6719-a06b-6dcf-9aa5-6d6497c38060@DancesWithMice.info>
X-Mailman-Original-References: <2110321349.5908606.1681897884162.ref@mail.yahoo.com>
<2110321349.5908606.1681897884162@mail.yahoo.com>
<b36efc8f-7fcf-e646-57e1-1f008d8f719a@yahoo.co.uk>
<06af8d39-a128-27e6-eeb8-f9e3f8fde7b6@DancesWithMice.info>
<692943468.6227351.1681935070220@mail.yahoo.com>
 by: dn - Wed, 19 Apr 2023 23:19 UTC

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>


Click here to read the complete article

devel / comp.lang.python / Re: PyCharm's strict PEP and not so strict?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor