A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008857.html below:

[Python-Dev] Lukewarm about range literals

[Python-Dev] Lukewarm about range literals [Python-Dev] Lukewarm about range literalsSkip Montanaro skip@mojam.com (Skip Montanaro)
Mon, 28 Aug 2000 16:46:19 -0500 (CDT)
    Guido> I notice that:

    Guido>   for i in [:100]: print i

    Guido> looks a bit too much like line noise.  I remember that Randy
    Guido> Pausch once mentioned that a typical newbie will read this as:

    Guido>   for i in 100 print i

Just tossing out a couple ideas here.  I don't see either mentioned in the
current version of the PEP.

    1. Would it help readability if there were no optional elements in range
       literals?  That way you'd have to write

	for i in [0:100]: print i

    2. Would it be more visually obvious to use ellipsis notation to
       separate the start and end inidices?

        >>> for i in [0...100]: print i
	0
	1
	...
	99

	>>> for i in [0...100:2]: print i
	0
	2
	...
	98

I don't know if either are possible syntactically.

Skip



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