On 15/01/24 11:47, Chris Angelico via Python-list wrote:
On Mon, 15 Jan 2024 at 09:40, dn via Python-list <python-list@python.org> wrote:
The basic challenge came from my earlier (and blasé) repetition of the
Python refrain "everything in Python is an object". Which led to:
...

So, no, there's an "everything" which (might be) an object but which
cannot be used in that scenario.

More accurately, every VALUE in Python is an object. This does not
mean that syntax is an object. Very few languages would say that every
single grammatical element is a value.

+1

Thank you. This old-dog will try to re-learn that term...


Yes, it's sloppy to say "everything" is an object, but it's also
rather nonintuitive to claim that, therefore, syntax elements are all
objects. It's like claiming that everything that this dealership sells
is a car (or "everything in this dealership is a car"), and therefore
the dealership's name must itself be a car.

To say nothing of 'extended warranties'!
(and their dubious rationale)


That said, does anyone think that something like:

      for a_function( etc ) in iterable/iterator:

is acceptable?
- see both Python definition and (full-)quotation.

I've not come-across a language which does allow such - YMMV/mea culpa;
and am struggling to see how it could possibly be useful.

You could do something close to that:

for a_function(etc)[0] in iterable: ...

because an assignment target can contain an arbitrary expression
followed by the subscript.

Here's another witticism I'll often toss at trainees (in many languages, and especially in UX): just because we can do it, doesn't make it a good idea!


* Looking at the correspondent's email-address (cf 'handle') - and as an
unfair stereotype, raises the question of issues related to (English)
language-skills - which, arrogantly implies/assumes that native
English-speakers are all highly-capable. (?) A negative-interpretation
is to note his apparent intelligence, but wonder if failing to represent
others' comments fairly is deliberate, or carelessness. Is there an
irony in behaving/failing in such, whilst attempting to hold Python's
structure to some golden-ideal?

Seems likely.


--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to