A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038812.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntax [Python-Dev] accumulator display syntaxMichael Chermside mcherm at mcherm.com
Thu Oct 16 08:31:34 EDT 2003
Alex Martelli writes:
> I think we could extend indexing to mean something different when
> the [ ] contain a 'for', just like we extended list display to mean
> something different (list comprehension) when the [ ] contain a
> 'for'.  Syntax such as:
> 
>     Top(10)[ humor(joke) for joke in jokes ]
> 
> does not suggest a list is _returned_, just like foo[23] doesn't.

I find the syntax a bit confusing.

Are we subscripting here, or are we juxtaposing one expression
("Top(10)"), with a list comprehension ("[humor(joke) for joke in jokes]")?

Not totally unreadable, but it rubs me the wrong way. I read [] used
for subscripting as completely different from [] used for list literals
and list comprehensions. They just happen to share the same pair of
symbols. To me, this confuses the two somewhat.

-- Michael Chermside


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4