That is clear, Cameron, but on my python interpreter values evaluated on the command line ARE saved:
>>> numb = 5 >>> 5 + numb 10 >>> numb 5 >>> _ + _ + 1 11 >>> _ * 2 22 >>> The point is that a dummy variable of _ is assigned and re-assigned at each step and there can be a valid, if not very useful, reason to evaluating it and storing a result. If the darn thing is a very long name like alpha.beta.gamma.delta.epsilon then code that uses it repeatedly in the very next line can be much simpler by using _ repeatedly and perhaps more efficient. Consider: negsq = _ * -_ versus negsq = alpha.beta.gamma.delta.epsilon * - alpha.beta.gamma.delta.epsilon So does your linter now need to look ahead and see if "_" is used properly in the next line? Note it can also be used on the LHS where it means something else. Still, I grant generally a naked evaluation is generally an error. LOL! -----Original Message----- From: Python-list <python-list-bounces+avi.e.gross=gmail....@python.org> On Behalf Of Cameron Simpson Sent: Tuesday, November 15, 2022 4:13 AM To: python-list@python.org Subject: Re: In code, list.clear doesn't throw error - it's just ignored On 15Nov2022 00:45, avi.e.gr...@gmail.com <avi.e.gr...@gmail.com> wrote: >What would be the meaning of an ordering relation determining what is >MORE VALID? Are you asking what criterion would rate: clearx = x.clear as "more" valid than: x.clear on its own? I don't want to speak for the OP, but I'd think the OP's issue is that the bare `x.clear` is evaluated but not stored in a variable. As a metric, we might gather various descriptive statements we could make about these statements. They'd perhaps include "is legal Python code", "is pretty simple". The former line could include "saves the expression value in a variable for later use" and the latter could not. That's a comparison test you could use for ordering. My own opinion is that a bare: x.clear is legal and valid for all the example use cases already mentioned, but an entirely valid target for complaint by a linter, whose task is to point out dodgy looking stuff for review by the author. Cheers, Cameron Simpson <c...@cskk.id.au> -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list