[HN Gopher] Peculiar Self-References
___________________________________________________________________
Peculiar Self-References
Author : susam
Score : 28 points
Date : 2021-11-18 11:19 UTC (2 days ago)
(HTM) web link (susam.in)
(TXT) w3m dump (susam.in)
| cecilpl2 wrote:
| Neat idea! Seems like the following less-confusing assignment
| also works:
|
| a = [0]
|
| a[0] = a
| tshaddox wrote:
| Yeah, this article is more about the chained assignment syntax
| in Python which might not be on the radar for a lot of Python
| coders. There's nothing particularly interesting about the
| self-reference. You can do the same thing with bog-standard
| idiomatic code: just make an empty list and append it to
| itself.
| malf wrote:
| This is the first true "PHPism" I've seen in a "real language".
| (Is there a name for "we didn't want the general thing (e.g.
| assignment expressions) but we wanted one narrow subset of it
| (serial assignment), so we implemented that, but with different
| semantics for no good reason"?)
___________________________________________________________________
(page generated 2021-11-20 23:01 UTC)