Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Matter cannot be created or destroyed, nor can it be returned without a receipt.


devel / comp.lang.python / Re: In code, list.clear doesn't throw error - it's just ignored

SubjectAuthor
* In code, list.clear doesn't throw error - it's just ignoredDFS
+* Re: In code, list.clear doesn't throw error - it's just ignoredJon Ribbens
|+* Re: In code, list.clear doesn't throw error - it's just ignoredDFS
||+* Re: In code, list.clear doesn't throw error - it's just ignoredJon Ribbens
|||+* Re: In code, list.clear doesn't throw error - it's just ignoredGreg Ewing
||||+- Re: In code, list.clear doesn't throw error - it's just ignoredJon Ribbens
||||+* Re: In code, list.clear doesn't throw error - it's just ignoredMRAB
|||||`* Re: In code, list.clear doesn't throw error - it's just ignoredGreg Ewing
||||| `- Re: In code, list.clear doesn't throw error - it's just ignoredChris Angelico
||||+- Re: In code, list.clear doesn't throw error - it's just ignoredChris Angelico
||||`- Re: In code, list.clear doesn't throw error - it's just ignoredKarsten Hilbert
|||`- Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
||+* Re: In code, list.clear doesn't throw error - it's just ignoredChris Angelico
|||`* Re: In code, list.clear doesn't throw error - it's just ignoredDFS
||| +* Re: In code, list.clear doesn't throw error - it's just ignoredMichael Speer
||| |+- Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
||| |`- Re: In code, list.clear doesn't throw error - it's just ignoredChris Angelico
||| +- Re: In code, list.clear doesn't throw error - it's just ignoredRoel Schroeven
||| `* Re: In code, list.clear doesn't throw error - it's just ignoredCameron Simpson
|||  `* Re: In code, list.clear doesn't throw error - it's just ignoredDennis Lee Bieber
|||   +- Re: In code, list.clear doesn't throw error - it's just ignoredCameron Simpson
|||   `- RE: In code, list.clear doesn't throw error - it's just ignored<avi.e.gross
||`- Re: In code, list.clear doesn't throw error - it's just ignoreddn
|+* Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
||`- Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
|+* Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
||+- Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
||`- Re: In code, list.clear doesn't throw error - it's just ignoredJon Ribbens
|`* Re: In code, list.clear doesn't throw error - it's just ignoredStefan Ram
| `- Re: In code, list.clear doesn't throw error - it's just ignoredChris Angelico
+- Re: In code, list.clear doesn't throw error - it's just ignoredWeatherby,Gerard
+- Re: In code, list.clear doesn't throw error - it's just ignoredGilmeh Serda
`- Re: In code, list.clear doesn't throw error - it's just ignoredDan Stromberg

Pages:12
Re: In code, list.clear doesn't throw error - it's just ignored

<8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.27.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 15 Nov 2022 00:15:21 +0000
From: wlfr...@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Date: Mon, 14 Nov 2022 19:15:22 -0500
Organization: IISS Elusive Unicorn
Message-ID: <8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>
References: <uwicL.23347$t_J9.22390@fx43.iad> <Y3K8/qP7/xcGSAEu@cskk.homeip.net> <mailman.984.1668463881.20444.python-list@python.org>
User-Agent: ForteAgent/8.00.32.1272
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 29
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-lxhjOUZsEAsB7ZcR6a/I+VTXCalpDp50fpEawsVnZL8tvTHv0saznD/ec9WI1jye1Zi8mWHLtLyvG0A!8pb11uJeVeMOqExeGe0fdszvxsE9XayEY1stMrpo4nCCff/bvhN1QJyxztZk4sqk+Uvk7bXn
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 2131
 by: Dennis Lee Bieber - Tue, 15 Nov 2022 00:15 UTC

On Tue, 15 Nov 2022 09:11:10 +1100, Cameron Simpson <cs@cskk.id.au>
declaimed the following:

>On 13Nov2022 22:23, DFS <nospam@dfs.com> wrote:
>>This is an easy check for the interpreter to make.
>
>It really isn't, given that (a) this isn't known by the interpreter to
>be a `list` until runtime and (b) that would need embedding special
>knowledge that looking up an attribute on a `list` has no side effects
>(versus some other things, where it is not the case).
>

There is also the minor facet that "x.clear" can be bound to a
different name...

>>> x = [1, 2, 3.145926536, "Pie"]
>>> clearx = x.clear
>>> x
[1, 2, 3.145926536, 'Pie']
>>> clearx()
>>> x
[]
>>>

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

Re: In code, list.clear doesn't throw error - it's just ignored

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Date: Tue, 15 Nov 2022 13:33:40 +1100
Lines: 25
Message-ID: <mailman.991.1668479626.20444.python-list@python.org>
References: <8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>
<Y3L6hMruQKVxx+L7@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de u5O1kmsmQL0CuOTpPGGsOgLDc+6Evly82Qxjv4RPvLiA==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'this:': 0.03;
'subject:error': 0.07; 'cheers,': 0.11; '>>>>': 0.16; 'cameron':
0.16; 'from:addr:cs': 0.16; 'from:addr:cskk.id.au': 0.16;
'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net':
0.16; 'received:13.237': 0.16; 'received:13.237.201': 0.16;
'received:13.237.201.189': 0.16; 'received:cskk.id.au': 0.16;
'received:id.au': 0.16; 'received:mail.cskk.id.au': 0.16;
'simpson': 0.16; 'stance': 0.16; 'subject:code': 0.16; 'wrote:':
0.16; 'to:addr:python-list': 0.20; 'header:User-Agent:1': 0.30;
'think': 0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34;
'received:au': 0.35; 'valid': 0.39; 'received:13': 0.64;
'received:userid': 0.66; 'minor': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>
User-Agent: Mutt/2.2.7 (2022-08-07)
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: <Y3L6hMruQKVxx+L7@cskk.homeip.net>
X-Mailman-Original-References: <8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>
 by: Cameron Simpson - Tue, 15 Nov 2022 02:33 UTC

On 14Nov2022 19:15, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> There is also the minor facet that "x.clear" can be bound to a
>different name...
>
>>>> x = [1, 2, 3.145926536, "Pie"]
>>>> clearx = x.clear
>>>> x
>[1, 2, 3.145926536, 'Pie']
>>>> clearx()
>>>> x
>[]
>>>>

I think the OP would take the stance that this:

clearx = x.clear

is more valid than:

x.clear

which discards the return value of the expression.

Cheers,
Cameron Simpson <cs@cskk.id.au>

RE: In code, list.clear doesn't throw error - it's just ignored

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From:
Newsgroups: comp.lang.python
Subject: RE: In code, list.clear doesn't throw error - it's just ignored
Date: Tue, 15 Nov 2022 00:45:17 -0500
Lines: 122
Message-ID: <mailman.994.1668491122.20444.python-list@python.org>
References: <8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>
<Y3L6hMruQKVxx+L7@cskk.homeip.net>
<001a01d8f8b5$717bfdf0$5473f9d0$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 7c3UTgtRv6vvzFXI/0Ql7ABqgnAC7K0ePXnDpg5EfOlQ==
Return-Path: <avi.e.gross@gmail.com>
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=gmail.com header.i=@gmail.com header.b=RFMeduqs;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.008
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'this:': 0.03; '2022':
0.05; 'fairly': 0.05; 'variable': 0.05; 'subject:error': 0.07;
'compiler': 0.09; 'divide': 0.09; 'expression': 0.09; 'later,':
0.09; 'received:209.85.219': 0.09; 'snippets': 0.09; 'cheers,':
0.11; 'url:mailman': 0.15; '>>>>': 0.16; 'accessed': 0.16;
'another,': 0.16; 'cameron': 0.16; 'count.': 0.16; 'determining':
0.16; 'effects.': 0.16; 'equally': 0.16; 'error?': 0.16;
'evaluated.': 0.16; 'exists:': 0.16; 'expenses': 0.16; 'feature.':
0.16; 'flexibility.': 0.16; 'found.': 0.16; 'hint': 0.16;
'ignored': 0.16; 'importing': 0.16; 'instead.': 0.16;
'interpreter': 0.16; 'mean,': 0.16; 'mentioned,': 0.16; 'min':
0.16; 'odd': 0.16; 'once.': 0.16; 'simpson': 0.16; 'spectrum':
0.16; 'stance': 0.16; 'subject:code': 0.16; 'wrote:': 0.16;
'values': 0.17; 'instead': 0.17; 'message-id:@gmail.com': 0.18;
'uses': 0.19; 'bug': 0.19; 'to:addr:python-list': 0.20; 'machine':
0.22; 'written': 0.22; 'returns': 0.22; 'code': 0.23; 'goal':
0.23; 'run': 0.23; 'skip:- 10': 0.25; 'url-ip:188.166.95.178/32':
0.25; 'url-ip:188.166.95/24': 0.25; 'discussion': 0.25;
'examples': 0.25; 'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25;
'seems': 0.26; 'again,': 0.26; 'pattern': 0.26; 'suspect': 0.26;
'leave': 0.27; 'else': 0.27; 'function': 0.27; 'example,': 0.28;
'error': 0.29; 'code,': 0.31; 'seem': 0.31; 'comment': 0.31;
'module': 0.31; 'url-ip:188/8': 0.31; 'think': 0.32; "doesn't":
0.32; 'context': 0.32; 'python-list': 0.32; 'zero': 0.32; 'but':
0.32; 'there': 0.33; 'someone': 0.34; 'same': 0.34; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34; 'trying': 0.35;
'meaning': 0.35; 'from:addr:gmail.com': 0.35; 'cases': 0.36;
'possibly': 0.36; 'people': 0.36; 'change': 0.36; 'using': 0.37;
"it's": 0.37; 'received:209.85': 0.37; 'way': 0.38; 'could': 0.38;
'means': 0.38; 'error,': 0.38; 'from:': 0.62; 'to:': 0.62;
'reasonable': 0.62; 'come': 0.62; 'true': 0.63; 'simply': 0.63;
'between': 0.63; 'pass': 0.64; 'full': 0.64; 'in:': 0.64; 're:':
0.64; 'your': 0.64; 'look': 0.65; 'less': 0.65; 'let': 0.66;
'back': 0.67; 'caught': 0.67; 'prevent': 0.67; 'away': 0.67;
'enhance': 0.69; 'obvious': 0.69; 'below': 0.69; 'began': 0.70;
'ignore': 0.71; 'longer': 0.71; 'chain': 0.76; 'languages,': 0.76;
'poor': 0.76; 'ranging': 0.76; 'see,': 0.76; 'out,': 0.78;
'sent:': 0.78; 'challenged': 0.84; 'gone,': 0.84; 'horrible':
0.84; 'increments': 0.84; 'interpreters': 0.84; 'minor': 0.84;
'optimizing': 0.84; 'ordering': 0.84; 'saved,': 0.84; 'subtle':
0.84; 'valid,': 0.84; 'warning': 0.84; 'weird': 0.84; 'truth':
0.86; 'deliberately': 0.91; 'retain': 0.91; 'cut': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=ADkddTF0FQg+wyc3vqccF3lZo+fn8nXTwTV86Pi2G/Y=;
b=RFMeduqshwE9p9+CBXoIY9HIGXxWIolI5qovvnsf4qCwmIZIbeuYBev87ipsMgw8se
kXYQiB65X0OLYAal/n3lXtm2T0Bm/KHiDaNlir8RFwkXlcOoXqyNPO9h59sI/Q7SgWtN
HoBEFxJPPdK7fDfG0VwEXjBxXP9bT1poN16ZeIBIqXFPwroZ2KBtglRoa1SwoazVf81K
irjVbWW0q6Rcg12pbaMQCsmnG6B/oWlrW7OwWRlUCcGWBf4o3rSlpU0QnTrPhU4MuDN1
HSY134gAaWseqiAsQijhvQfQKefYxdrAxjfV9hWrm58KSXcEc9b9d8NT75xd93HLl7T3
qzUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=ADkddTF0FQg+wyc3vqccF3lZo+fn8nXTwTV86Pi2G/Y=;
b=hcDokNif3LBUUG+nv2cs90rrR65IpYp95x6B3glqQm+EPeqJ2sA2VMS/364HXIyKrp
pPSJfNiLymYRuUjvZi/3v/+WzvSCmJtAzbFOn5tNq83s2MjwsXusI+gnqn99+61hsqjv
NWolKzUGqTm4Geh63hU54ObqrHB+vobqo/qVBvBKwpuw9IJ8woN5J7pjYSjDuj4W6zya
b9V9R7rjiH/XTFtFcPelltpmXLCuw1QUWMJuQcF+/M8IKq3KR2doGACe30qnpx0l1dpt
qh6jKHpgas/Jf3O76aGUeW0RWA7TWhcIsSUsxF8PT0b4zGlhVJXlPT0ktNltXxRCSSgM
UZwA==
X-Gm-Message-State: ANoB5plv3+NQaO7vyWvUAQRLc2YZCSyNBYhpyJrN4rVewI9JmGMw4/dU
p6i9dcndcWWdTvIblPPZLe8rJxrF/Ag=
X-Google-Smtp-Source: AA0mqf6EBAO8Or5Ks9QiRlrFj8f/9td3R4t6HRuD830/MfmbcLDygco8sDikoKz/Jh3FHJDpjWe3wA==
X-Received: by 2002:a0c:c303:0:b0:4bb:6943:8df3 with SMTP id
f3-20020a0cc303000000b004bb69438df3mr15094479qvi.106.1668491119590;
Mon, 14 Nov 2022 21:45:19 -0800 (PST)
In-Reply-To: <Y3L6hMruQKVxx+L7@cskk.homeip.net>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQIJdBzvNILxf5ofrvcGQFrHS1GfXgIKIkfSrc4vGAA=
Content-Language: en-us
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: <001a01d8f8b5$717bfdf0$5473f9d0$@gmail.com>
X-Mailman-Original-References: <8bm5nhlvh5tcqk0n75a9fuuplv76q90u7b@4ax.com>
<Y3L6hMruQKVxx+L7@cskk.homeip.net>
 by: - Tue, 15 Nov 2022 05:45 UTC

Cameron,

What would be the meaning of an ordering relation determining what is MORE
VALID?

As has been pointed out, not only are some uses that look odd sometimes
valid, but perhaps even can be used in ways you simply may not see, such as
side effects. Some examples ranging from poor to horrible are mentioned
below.

In some languages, trying to access a variable that is not properly existing
or initialized, can generate an error, as an example, which may cause the
current function to terminate if not caught and jump up the call chain till
an error handler is found. Code like:

1/0

May seem meaningless as the result is not saved, but may trigger a divide by
zero error.

Is it an error to write code like:

If x.clear:
pass

I suspect it is possible to write quite weird code that might pass most
linters but that does nothing useful and also to write code that is useful
but might be disparaged by many interpreters or linters.

My example above is a fairly common code pattern while code is being written
as a sort of reminder to perhaps come back later and flesh it out properly,
or remove it if it is no longer applicable. If so, it would be reasonable
for it to be challenged and also to ignore such warnings until later when
either it is gone, or the code hint should be gone.

There are many cases where short-circuit evaluation means code is not run
such as "True || x" that is less obvious but equally bypassed if you set a
variable to True and do not change it and use it instead of True above. But
is it an error? What if again, my later goal is to add code that may change
the Truth value. As it is, the statement is not evaluated. But it may be set
up as a placeholder to enhance later, perhaps long after, or retain some
flexibility. Insisting it be removed might be too harsh while a warning
might be reasonable. Yet again, it is not always an error to not use
something like declaring a variable you might need or importing a module you
never use.

Code is chock full of such things in mid-stream. And you can deliberately
ignore some things without it being a mistake as in:

( _, mean, _) = minMeanMax(args)

Sure, it may be overkill to call a function that returns three things then
ignore two of them. So what? What if instead of "_" I used real variable
names like min and max? Should I get error messages that two variable are
set up with values but never again used?

Or consider what I sometimes do when I write code that someone else will use
and to test it I must use something like a different filename/path on my
machine than they do on theirs. I might write code like

# Comment out one or more of the below so only one exists:
Place = "whatever"
Place = "Some other place"

Clearly if I am using the second one, I can comment the first out OR I can
leave it alone and at minor expenses let the variable be unconditionally
reset to the second value. Is it a bug or a feature?

I could go on with other examples including some more subtle ones like
declaring a variable name just to mask another variable from being
accessible from a higher level and perhaps prevent the interpreter or
compiler optimizing it away by using it in the meaningless way this
discussion began with as it has been accessed once.

One person's bug can be another person's feature. And clearly, as has been
mentioned, there MAY be subtle side effects like invoking your custom setter
or dunder method which also does logging or increments a count.

There is a spectrum between being overly permissive and overly strict. This
case almost amuses me because of the way that many a REPL works so something
run directly in a console will take an expression like "varname" and PRINT
the current value to the screen. If the same code is run from a file, or
from inside some function, it does nothing useful and you need something
like "print(varname)" instead. People often cut and paste such snippets of
code and in one context they did something and in another, it seems
meaningless and possibly an error.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Cameron Simpson
Sent: Monday, November 14, 2022 9:34 PM
To: python-list@python.org
Subject: Re: In code, list.clear doesn't throw error - it's just ignored

On 14Nov2022 19:15, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> There is also the minor facet that "x.clear" can be bound to a
>different name...
>
>>>> x = [1, 2, 3.145926536, "Pie"]
>>>> clearx = x.clear
>>>> x
>[1, 2, 3.145926536, 'Pie']
>>>> clearx()
>>>> x
>[]
>>>>

I think the OP would take the stance that this:

clearx = x.clear

is more valid than:

x.clear

which discards the return value of the expression.

Cheers,
Cameron Simpson <cs@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

<print-20221116113238@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Date: 16 Nov 2022 10:39:15 GMT
Organization: Stefan Ram
Lines: 65
Expires: 1 Sep 2023 11:59:58 GMT
Message-ID: <print-20221116113238@ram.dialup.fu-berlin.de>
References: <akdcL.10609$Sb52.676@fx45.iad> <slrntn2rd7.4623.jon+usenet@raven.unequivocal.eu> <C-20221114092106@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de kVj+RPhDS9ctmbabXn11dALG+SRYhX5VlcB0pMFXR0EFsj
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 16 Nov 2022 10:39 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>In VBA, "debug.print" is allowed, having the same meaning as
>"debug.print()", while "sin" gives an error: "Argument is not
>optional".

In Python 2.6, one could write

print

to print an empty line. Today, "print" would be a mere name.

print
<built-in function print>

In Python 3.9, one needs to write

print()

for the same effect as "print" had in Python 2.6.

One also could have gone the other way, that of VBA.
By this, we would be able to call any function without
parenthesis in the top (outermost) level of a statement.

So, if I would have written a function

def trace( message ):
print message

, I would then be able to call it via

trace "my message"

. It would look as if the language could be extended
by new user-defined commands, while under the hood it
would still be a function call.

One would be able to define a no-argument function:

def here:
print "I'm here."

and call it with just the statement

here

. This would not prevent functions as values.

return here

,

print here

or

x = here

could still be used, because in those cases "here" is not
used at the /outermost/ level of a statement. So in those
cases, it would denote the function, not invoke it.

Re: In code, list.clear doesn't throw error - it's just ignored

<linter-20221123201455@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Date: 23 Nov 2022 19:16:48 GMT
Organization: Stefan Ram
Lines: 42
Expires: 1 Sep 2023 11:59:58 GMT
Message-ID: <linter-20221123201455@ram.dialup.fu-berlin.de>
References: <akdcL.10609$Sb52.676@fx45.iad> <slrntn2rd7.4623.jon+usenet@raven.unequivocal.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 4TL0P9MocF5hBkXkhkZjGwecfPT2TEyD+KHcSW6kyNKnXz
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Wed, 23 Nov 2022 19:16 UTC

Jon Ribbens <jon+usenet@unequivocal.eu> writes:
>If you want to catch this sort of mistake automatically then you need
>a linter such as pylint:

output

<string>, line 1
list.clear
Warning: Attribute used as statement.

<string>, line 5
list.clear
Warning: Attribute used as statement.

source code

import ast, sys

def check( point, source ):
if isinstance( point, ast.Expr ) and\
type( point.value )== ast.Attribute:
print( "<string>, line", point.lineno, file=sys.stderr )
print( source.split( '\n' )[ point.lineno-1 ], file=sys.stderr )
print\
( "Warning:", "Attribute used as statement.", file=sys.stderr )
print()

def mylinter( source ):
for point in ast.walk( ast.parse( example )):
check( point, source )

example = """\
list.clear
list.clear()
x = list.clear
print( list.clear )
list.clear
"""

mylinter( example )

Re: In code, list.clear doesn't throw error - it's just ignored

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

  copy mid

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

  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: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Date: Thu, 24 Nov 2022 06:28:45 +1100
Lines: 47
Message-ID: <mailman.1033.1669231739.20444.python-list@python.org>
References: <akdcL.10609$Sb52.676@fx45.iad>
<slrntn2rd7.4623.jon+usenet@raven.unequivocal.eu>
<linter-20221123201455@ram.dialup.fu-berlin.de>
<CAPTjJmpT9XUspGDZuygUXosSh=O3mgKXh5u_-G+UvGaMrGOSCw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de L6YhXO+TKsvMaP53vh5wGAQHzo55DOuRTdh2MjIQe/5Q==
Return-Path: <rosuav@gmail.com>
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=gmail.com header.i=@gmail.com header.b=p0SiA7EP;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; '2022': 0.05;
'ram': 0.07; 'subject:error': 0.07; '"""': 0.09; 'writes:': 0.09;
'import': 0.15; 'chrisa': 0.16; 'from:addr:rosuav': 0.16;
'from:name:chris angelico': 0.16; 'print(': 0.16;
'received:209.85.208.42': 0.16; 'received:mail-
ed1-f42.google.com': 0.16; 'subject:code': 0.16; 'warning:': 0.16;
'wrote:': 0.16; 'thu,': 0.19; 'to:addr:python-list': 0.20; 'code':
0.23; 'stefan': 0.26; 'output': 0.28; 'point,': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'source': 0.36; 'received:209.85': 0.37; 'received:209': 0.39;
'received:209.85.208': 0.39; 'want': 0.40; 'your': 0.64;
'attribute': 0.84; 'catch': 0.84; 'jon': 0.84; 'statement.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=F30vmY6Z7fe/VC+VcE2RZlEBrs3uIinqOh3QcCmI2LU=;
b=p0SiA7EPt9APvR61BNYm5wF0DrsLv31Kzol8HE1KmxXH6b0bHHkVgrunkgxPn8RaPO
4Wje1Y4cc9NpdNbrDk5ld/f2SEFRDGCs7fWp4s/0jz148ySPH00wNn09pLLqLFE7m9xb
i5AZN13KIQL7zh7RcogrCXD+n098tebQGEshSTHLN2dK7EniHjLJRNfgWE3w88kq1zId
kNtBGQV6yg0cBWkvKWaM8zbYukvmFnKu3ozJdAtdErDTZ050lbczLonDdk+FK51NAyzs
+ktCXCmi2fKTzDWNZjijFdiaqbIb03iGywlCyBQwsIJGBb3rbhsW7k8WdHoibGlr/eAg
FODA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=F30vmY6Z7fe/VC+VcE2RZlEBrs3uIinqOh3QcCmI2LU=;
b=6VnWN2DWR/ICKgW3vt4Jj35+wspLZiLPxuc+J6zlqCJz1Gx2LmB+cVtkjkqFz9hcg+
nhtotWza17Tl1bLQK9EQXxXx8qJhj9uUMgAML33IBkuHS/osUhyQqe3O1XBIO0Qxji7L
Dx8+Cbgud2ILU7GYzdcx9CwsK1vk39p/SFqNTAIWMe34315lzGGwoBniVwQX1+LsPsDD
QrNGPcp5QGam/9jID6knb1eotu4T2sKEOM0dbFw/atlQzd1KYMjwjSMFDXk91SNclF8/
qd9GqvkNjxHD+Wqgl+ZTjVreFcExCJhbdt3IQ77WVPq0afUd+3hgBsuVhi8pB9Hcv0pO
za5Q==
X-Gm-Message-State: ANoB5pmUddZFg+/e4zqZs/LW2Oeanyt2oDQ82FIwudwHq705zzXuZ+Cr
QMf411CDwxW6oBOnboIyNDaKCD5CyrjEG4Sdseta4J3Q
X-Google-Smtp-Source: AA0mqf4z60tdhqBHukxUZFIvr4XDfBmqj+OLXtjcnnEBQWJ8q7Ij6flW/8akGEfv8Y3uXSBgzwLnbGRot9NJU9y8vcY=
X-Received: by 2002:a05:6402:364:b0:461:ac48:a5ec with SMTP id
s4-20020a056402036400b00461ac48a5ecmr27236838edw.193.1669231737093; Wed, 23
Nov 2022 11:28:57 -0800 (PST)
In-Reply-To: <linter-20221123201455@ram.dialup.fu-berlin.de>
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: <CAPTjJmpT9XUspGDZuygUXosSh=O3mgKXh5u_-G+UvGaMrGOSCw@mail.gmail.com>
X-Mailman-Original-References: <akdcL.10609$Sb52.676@fx45.iad>
<slrntn2rd7.4623.jon+usenet@raven.unequivocal.eu>
<linter-20221123201455@ram.dialup.fu-berlin.de>
 by: Chris Angelico - Wed, 23 Nov 2022 19:28 UTC

On Thu, 24 Nov 2022 at 06:26, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>
> Jon Ribbens <jon+usenet@unequivocal.eu> writes:
> >If you want to catch this sort of mistake automatically then you need
> >a linter such as pylint:
>
> output
>
> <string>, line 1
> list.clear
> Warning: Attribute used as statement.
>
> <string>, line 5
> list.clear
> Warning: Attribute used as statement.
>
> source code
>
> import ast, sys
>
> def check( point, source ):
> if isinstance( point, ast.Expr ) and\
> type( point.value )== ast.Attribute:
> print( "<string>, line", point.lineno, file=sys.stderr )
> print( source.split( '\n' )[ point.lineno-1 ], file=sys.stderr )
> print\
> ( "Warning:", "Attribute used as statement.", file=sys.stderr )
> print()
>
> def mylinter( source ):
> for point in ast.walk( ast.parse( example )):
> check( point, source )
>
> example = """\
> list.clear
> list.clear()
> x = list.clear
> print( list.clear )
> list.clear
> """
>
> mylinter( example )
>

Uhh, yes? You just created an extremely simplistic linter. Your point?

ChrisA

Re: In code, list.clear doesn't throw error - it's just ignored

<HlUfL.2063452$5p2.1919922@fx15.ams4>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx15.ams4.POSTED!not-for-mail
From: gilmeh.s...@nothing.here.invalid (Gilmeh Serda)
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Newsgroups: comp.lang.python
References: <akdcL.10609$Sb52.676@fx45.iad>
MIME-Version: 1.0
x-no-archive: yes
User-Agent: Pan/0.151 (Butcha; a6f6327)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 22
Message-ID: <HlUfL.2063452$5p2.1919922@fx15.ams4>
X-Complaints-To: abuse@easynews.com
Organization: Easynews - www.easynews.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 25 Nov 2022 00:52:55 GMT
X-Received-Bytes: 1405
 by: Gilmeh Serda - Fri, 25 Nov 2022 00:52 UTC

On Sun, 13 Nov 2022 16:28:39 -0500, DFS wrote:

> In code, list.clear is just ignored.
> At the terminal, list.clear shows <built-in method clear of list object
> at 0x000001C9CFEC4240>

It is obvious why ignores it. It's a method:

Python 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> l=[1,2,3]
>>> help(l.clear)

Help on built-in function clear:

clear() method of builtins.list instance
Remove all items from list.

--
Gilmeh

Contains no artificial colors or ingredients.

Re: In code, list.clear doesn't throw error - it's just ignored

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!not-for-mail
From: drsali...@gmail.com (Dan Stromberg)
Newsgroups: comp.lang.python
Subject: Re: In code, list.clear doesn't throw error - it's just ignored
Date: Fri, 25 Nov 2022 07:56:22 -0800
Lines: 67
Message-ID: <mailman.1046.1669391797.20444.python-list@python.org>
References: <akdcL.10609$Sb52.676@fx45.iad>
<CAGGBd_o1obWAufD5Q01p8j4jArM5fZpgnC1Rq=UuANS=DQkBBg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de kI3kA4st//B9jsIr5NSqqwR7uQQlbYeEkOH8QwL2feiw==
Return-Path: <drsalists@gmail.com>
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=gmail.com header.i=@gmail.com header.b=i8UOncSn;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'def': 0.04; '2022': 0.05;
'subject:error': 0.07; 'sun,': 0.07; 'cc:addr:python-list': 0.09;
'refused': 0.09; 'skip:x 10': 0.09; 'cc:no real name:2**0': 0.14;
'url:mailman': 0.15; 'cat': 0.16; 'fri': 0.16;
'from:addr:drsalists': 0.16; 'from:name:dan stromberg': 0.16;
'frustration': 0.16; 'ignored.': 0.16; 'interpreter': 0.16;
'python3': 0.16; 'subject:code': 0.16; 'wrote:': 0.16;
'cc:addr:python.org': 0.20; 'skip:_ 10': 0.22; 'code': 0.23; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'cc:2**0': 0.25; 'url-ip:188.166/16': 0.25;
'object': 0.26; 'done': 0.28; 'fact': 0.28; 'output': 0.28;
'code,': 0.31; 'url-ip:188/8': 0.31; '13,': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; "i'm": 0.33; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34; 'meaning': 0.35;
'from:addr:gmail.com': 0.35; 'change': 0.36; 'received:209.85':
0.37; 'class': 0.37; 'received:209': 0.39; 'list': 0.39;
'something': 0.40; 'method': 0.61; 'skip:0 20': 0.61; 'above':
0.62; 'clear': 0.64; '100%': 0.66; 'shows': 0.67; 'skip:# 10':
0.68; 'below': 0.69; 'see,': 0.76; '4:45': 0.84; 'caused': 0.86
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=WMNDJNrQCI++2cmzPEP77fEJF9Ty9PPIVx3a52v4fLQ=;
b=i8UOncSnFC2fwNQX42v62qpoyst4dDuyVvxdE6ccCsoDyiSwTuDz78vIgbshHoJz32
zo9JX2mKnNTOW5/d9agra9IaWnK8qkqY8ShsdtUqqeCRJBjf1Wme/bG59Y6eQG+IPWoO
REH3+TDPfAtiR3U05kiVzK+nqVGKxCjVwGVH/WEUyHNXWdsaW3XpvDBylT8Bhk/XP2jS
VITYvpCMiizgDARZ2Uh3bSwB8uMpPaxnCMvt861q7kkASXAKnIXVwhS/ObU3eG1ek3ht
4QXIEscZ95aUYaGt/FABYmHexFd7JYXuMWOOJ2Nmk0t+gJGGYX9YvMBizUDvCl5vbLll
6ykA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=WMNDJNrQCI++2cmzPEP77fEJF9Ty9PPIVx3a52v4fLQ=;
b=WNHihPaKJaPo2ceB7ktNciYpKCPnBRYlhX6d1CTXc7GQvZXbkrTCmq/+DkHE3WU9hQ
vPTUgZgy7WKYw4V93A+5CFpjzOYUP09bltkIpZHi9KSc5GT6nNoirkSLYIuc8ih6lK7H
dqLMon5oEQwpPAYgQsZWbQ8YjAOYyiuHZMwuuIquGZ/UyRiNQbpRf3HYrL8YLqmll+zT
+G6WjwDP0aXQau4B6vQinrFjC3fEaBYHUXy4jd1rKiyUCQVLiIevqAqpYfDiZusGaO3b
EMUHS78AaVp7R9MHvW45fCDedAV5mm1ajNy0pqbVcxiSuDO4kjFNE1kYFDFFKt/whuda
pamA==
X-Gm-Message-State: ANoB5pknk6aEbvR+WoNMVHG9as5XKPpZsqO0KElq3Xsa0fEUvdzZ2V9z
3ip8sHRJOuFiydQFPNv+UiURSZFA1oGI9auR1UKsnKTFfVs=
X-Google-Smtp-Source: AA0mqf4xj1iqp7jz1fAl9fEmlqoCpRfldwDiZnrZ/ImIP8G33viQVxMXBPDbHHHKHHZgMxsH4M3v2yXn0e8VpFNb3fQ=
X-Received: by 2002:adf:f5c3:0:b0:241:e745:214 with SMTP id
k3-20020adff5c3000000b00241e7450214mr10145331wrp.683.1669391795359; Fri, 25
Nov 2022 07:56:35 -0800 (PST)
In-Reply-To: <akdcL.10609$Sb52.676@fx45.iad>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
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: <CAGGBd_o1obWAufD5Q01p8j4jArM5fZpgnC1Rq=UuANS=DQkBBg@mail.gmail.com>
X-Mailman-Original-References: <akdcL.10609$Sb52.676@fx45.iad>
 by: Dan Stromberg - Fri, 25 Nov 2022 15:56 UTC

On Sun, Nov 13, 2022 at 4:45 PM DFS <nospam@dfs.com> wrote:

> In code, list.clear is just ignored.
> At the terminal, list.clear shows
> <built-in method clear of list object at 0x000001C9CFEC4240>
>
>
> in code:
> x = [1,2,3]
> x.clear
> print(len(x))
> 3
>
> at terminal:
> x = [1,2,3]
> x.clear
> <built-in method clear of list object at 0x000001C9CFEC4240>
> print(len(x))
> 3
>
>
> Caused me an hour of frustration before I noticed list.clear() was what
> I needed.
>
> x = [1,2,3]
> x.clear()
> print(len(x))
> 0
>
> --
> https://mail.python.org/mailman/listinfo/python-list

I'm not 100% sanguine about properties, but the fact is they are part of
the language:

$ cat p
below cmd output started 2022 Fri Nov 25 07:54:42 AM PST
#!/usr/bin/env python3

class P:
def __init__(self):
self.count = 0

@property
def increment(self):
self.count += 1

def result(self):
return self.count

p = P()
p.increment
p.increment
print(p.result())
above cmd output done 2022 Fri Nov 25 07:54:42 AM PST
dstromberg@tp-mini-c:~/src/experiments/property x86_64-pc-linux-gnu 2670

$ ./p
below cmd output started 2022 Fri Nov 25 07:54:44 AM PST
2

As you can see, if the interpreter refused to do something with p.increment
because it has no parens, the meaning of this code would change
significantly.

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor