Date: Wed, 3 Aug 2016 09:11:42 -0700 From: Guido van Rossum guido@python.org
... It would be much cleaner if you could declare the
variable before the first `if`. But picking a good initializer is tricky, especially if you have a type that does not include None.
PEP-484 suggests ellipsis for this.
~Elazar
On Wed, Aug 3, 2016 at 10:52 AM, אלעזר elazarg@gmail.com wrote:
Date: Wed, 3 Aug 2016 09:11:42 -0700 From: Guido van Rossum guido@python.org
... It would be much cleaner if you could declare the variable before the first `if`. But picking a good initializer is tricky, especially if you have a type that does not include None.
PEP-484 suggests ellipsis for this.
But
x = ...
already has a meaning -- it assigns x the (fairly pointless) value Ellipsis (which is a singleton object like None).
On Thu, Aug 4, 2016 at 2:15 AM Greg Ewing greg.ewing@canterbury.ac.nz wrote:
Guido van Rossum wrote:
But
x = ...
already has a meaning -- it assigns x the (fairly pointless) value Ellipsis
You can always say
x = Ellipsis
if you really want that.
I appreciate that ``...`` is pointless in the core so that I'm free to give it a purpose in my own libraries. I prefer to write ``Ellipsis`` as ``...``.