Re: [Python-Dev] cpython (2.7): note Ellipsis syntax

On 07/30/11 17:00, benjamin.peterson wrote:
In 2.7, this is not true; ``...`` only works in slices there. Georg

Benjamin Peterson wrote:
why would you use Ellipsis outside of slices?
I could imagine someone wanting to use it as part of a function API. For example, print(a, b, c, ...) would have been a nice way to tell print() not to put a newline on the end. -- Greg

On 07/30/11 19:25, Benjamin Peterson wrote:
I wouldn't, but that's not the point: the wording as it is now will lead readers to think that they can use the Ellipsis singleton as in Python 3, and they will complain and report bugs about this. (Also, there must have been some reason to make "..." available everywhere for Python 3.) Georg

On 31/07/2011 07:47, Raymond Hettinger wrote:
I guess pass is too pass-é? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk

On Sun, Jul 31, 2011 at 4:28 PM, Georg Brandl <g.brandl@gmx.net> wrote:
(Also, there must have been some reason to make "..." available everywhere for Python 3.)
Not really - it just let us ditch some special casing in the compilation toolchain that *restricted* it to being used in subscripts (i.e. we were looking at the question from the "is there a good rationale for keeping this arbitrary restriction?" angle). Functionality wise, you could already write 'Ellipsis' everywhere you would otherwise have written '...' and you still have to write ':' as 'slice(None)' outside the context of a subscript operation. Although, as Raymond notes, it can make a nice substitute for 'pass' as a placeholder statement, and can also be used as a placeholder expression. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia

Benjamin Peterson wrote:
why would you use Ellipsis outside of slices?
I could imagine someone wanting to use it as part of a function API. For example, print(a, b, c, ...) would have been a nice way to tell print() not to put a newline on the end. -- Greg

On 07/30/11 19:25, Benjamin Peterson wrote:
I wouldn't, but that's not the point: the wording as it is now will lead readers to think that they can use the Ellipsis singleton as in Python 3, and they will complain and report bugs about this. (Also, there must have been some reason to make "..." available everywhere for Python 3.) Georg

On 31/07/2011 07:47, Raymond Hettinger wrote:
I guess pass is too pass-é? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk

On Sun, Jul 31, 2011 at 4:28 PM, Georg Brandl <g.brandl@gmx.net> wrote:
(Also, there must have been some reason to make "..." available everywhere for Python 3.)
Not really - it just let us ditch some special casing in the compilation toolchain that *restricted* it to being used in subscripts (i.e. we were looking at the question from the "is there a good rationale for keeping this arbitrary restriction?" angle). Functionality wise, you could already write 'Ellipsis' everywhere you would otherwise have written '...' and you still have to write ':' as 'slice(None)' outside the context of a subscript operation. Although, as Raymond notes, it can make a nice substitute for 'pass' as a placeholder statement, and can also be used as a placeholder expression. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (7)
-
Antoine Pitrou
-
Benjamin Peterson
-
Chris Withers
-
Georg Brandl
-
Greg Ewing
-
Nick Coghlan
-
Raymond Hettinger