meaning of [ ]

Steve D'Aprano steve+python at pearwood.info
Mon Sep 4 14:21:11 EDT 2017


On Tue, 5 Sep 2017 03:37 am, Rustom Mody wrote:

> My understanding is that the OP saw a 'for' inside a '[]' and wondered
> "WTF is this?"

Rustom, did you not notice that the OP seemed to understood the 'for' perfectly
well, but asked what the meaning of the [ ] delimiters is? He explicitly says:

"what [] means in this statement?"

and it's the subject of the thread! Apart from your own bias against explicit
for loops, what made you think that the OP understood the [] but was confused
by the "for" when he explicitly said the opposite?


[...]
> People prefer to give the implementation of comprehensions
> rather than giving the connection to its parent notion+notation which in
> all probability the OP knows and is simply unable to connect because of
> clunkyness of ASCII-fied syntax


You have no evidence at all that the OP knows set builder syntax. Most people
don't.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list