Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
On 07/30/11 19:25, Benjamin Peterson wrote: 2011/7/30 Georg Brandl g.bra...@gmx.net: On 07/30/11 17:00, benjamin.peterson wrote: http://hg.python.org/cpython/rev/402f94edf11b changeset: 71637:402f94edf11b branch: 2.7 user:Benjamin Peterson benja...@python.org date:Sat Jul 30 09:59:12 2011 -0500 summary: note Ellipsis syntax files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2930,7 +2930,7 @@ supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). -It is written as ``Ellipsis``. +It is written as ``Ellipsis`` or ``...``. In 2.7, this is not true; ``...`` only works in slices there. I know, but why would you use Ellipsis outside of slices? 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 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
On Jul 30, 2011, at 11:28 PM, Georg Brandl wrote: (Also, there must have been some reason to make ... available everywhere for Python 3.) It's really nice for stub functions: def foo(x): ... Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
On Sun, Jul 31, 2011 at 4:28 PM, Georg Brandl g.bra...@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 | ncogh...@gmail.com | Brisbane, Australia ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
On Sat, 30 Jul 2011 23:47:36 -0700 Raymond Hettinger raymond.hettin...@gmail.com wrote: (Also, there must have been some reason to make ... available everywhere for Python 3.) It's really nice for stub functions: def foo(x): ... Using a docstring looks a lot less hackish (and it encourages you to write a doc!): def foo(x): Some stub function. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
On 07/30/11 17:00, benjamin.peterson wrote: http://hg.python.org/cpython/rev/402f94edf11b changeset: 71637:402f94edf11b branch: 2.7 user:Benjamin Peterson benja...@python.org date:Sat Jul 30 09:59:12 2011 -0500 summary: note Ellipsis syntax files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2930,7 +2930,7 @@ supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). -It is written as ``Ellipsis``. +It is written as ``Ellipsis`` or ``...``. In 2.7, this is not true; ``...`` only works in slices there. Georg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
2011/7/30 Georg Brandl g.bra...@gmx.net: On 07/30/11 17:00, benjamin.peterson wrote: http://hg.python.org/cpython/rev/402f94edf11b changeset: 71637:402f94edf11b branch: 2.7 user: Benjamin Peterson benja...@python.org date: Sat Jul 30 09:59:12 2011 -0500 summary: note Ellipsis syntax files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2930,7 +2930,7 @@ supports no special operations. There is exactly one ellipsis object, named :const:`Ellipsis` (a built-in name). -It is written as ``Ellipsis``. +It is written as ``Ellipsis`` or ``...``. In 2.7, this is not true; ``...`` only works in slices there. I know, but why would you use Ellipsis outside of slices? -- Regards, Benjamin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython (2.7): note Ellipsis syntax
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 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com