On Mon, May 31, 2021 at 11:41 PM Steven D'Aprano
wrote:
> It's pretty standard behaviour for Python. Right now, `eval(repr(...))`
> works unless you have shadowed the name
> Ellipsis.
>
> >>> err = ValueError('something went wrong')
> >>> ValueError = list
> >>> eval(repr(err))
>
On Sat, May 29, 2021 at 12:46:11PM +0100, Matt del Valle wrote:
> My view is that variable decorators should be legal for:
>
> 1) assignment statements (so that the decorator can modify or replace the
> object that is getting assigned)
Can you explain what benefit a variable decorator in this ca
On Mon, May 31, 2021 at 09:12:42PM -0400, David Mertz wrote:
> >
> > I think you are going against the design of the language here. With only
> >
> a handful of critical exceptional cases (None, True, False are the only
> > ones that come to mind), names can be rebound.
> >
>
> The following genui
On Mon, May 31, 2021 at 9:12 PM David Mertz wrote:
> >>> foo = "bar"
>
>>> eval(repr(foo)) == eval(repr(eval(repr(foo
> True
> >>> eval(repr(None)) == eval(repr(eval(repr(None
> True
>
> Let's change the behavior of the Ellipsis object slightly to have either a
> .__call__() or .__getitem
>
> I think you are going against the design of the language here. With only
>
a handful of critical exceptional cases (None, True, False are the only
> ones that come to mind), names can be rebound.
>
The following genuinely surprised me. I was trying to show something
different in reply, but I
On Mon, 2021-05-31 at 11:37 -0300, André Roberge wrote:
> In Python `...` is referred to as `Ellipsis` and cannot be assigned to.
> Yet, one can assign any value to the name `Ellipsis`.
>
> Consider the following:
>
> ```
> > > > ...
> Ellipsis
> > > > ... == Ellipsis
> True
> > > > Ellipsis
> E
On Mon, May 31, 2021 at 10:55:08PM +0100, MRAB wrote:
> >>>> a = []; a.append(a); a
> >[[...]]
> >>>> [[...]]
> >[[Ellipsis]]
> >
> Why is it 3 dots anyway? As we've already ascribed a meaning to 3 dots,
> why not use 4 dots in this use?
Three dots for ommitted text is standard i
On Mon, May 31, 2021 at 12:36:34PM -0300, André Roberge wrote:
> Thinking some more about it, perhaps the confusion would be sufficiently
> reduced if the repr of '...' would be 'Ellipsis (...)', and use this repr
> to appear in error messages rather than simply the name Ellipsis.
I think you are
On 2021-05-31 21:19, Serhiy Storchaka wrote:
31.05.21 22:46, Chris Angelico пише:
Originally, the notation "..." could only be used inside a subscript,
and anywhere else, you'd have to spell it "Ellipsis". Now that you can
use "..." anywhere, would it be worth switching the repr to just be
that?
On 2021-05-31 12:46, Chris Angelico wrote:
On Tue, Jun 1, 2021 at 5:40 AM David Mertz wrote:
I think making 'Ellipsis' a reserved word is too much. The analogy with
non-reserved words like `int`, `str`, `map`, `print`, and so on, illustrate
this, I think. I.e. redefining those is likely to
31.05.21 23:28, Chris Angelico пише:
> Although... since that's an arbitrary placeholder, it could be changed
> to pretty much anything. Maybe <...> or something? The current repr
> may not technically be ambiguous, but it will silently do the wrong
> thing if you try to eval it. You can even ast.l
On Tue, Jun 1, 2021 at 6:22 AM Serhiy Storchaka wrote:
>
> 31.05.21 22:46, Chris Angelico пише:
> > Originally, the notation "..." could only be used inside a subscript,
> > and anywhere else, you'd have to spell it "Ellipsis". Now that you can
> > use "..." anywhere, would it be worth switching t
31.05.21 22:59, Jelle Zijlstra пише:
> Why isn't `repr(...)` just `...`?
Because it would confuse with reprs for recursive collections.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.or
31.05.21 22:46, Chris Angelico пише:
> Originally, the notation "..." could only be used inside a subscript,
> and anywhere else, you'd have to spell it "Ellipsis". Now that you can
> use "..." anywhere, would it be worth switching the repr to just be
> that?
How would you then distinguish a recur
On Mon, 31 May 2021 at 13:10, Neil Girdhar wrote:
>
> Have you considered using the JAX library's trick of decorating functions to
> provide automatic symbols?
>
> For example, your problem could be done in current Python with an
> appropriately-coded library:
>
> @symbolic
> def f(x, a, b, c):
+1
On Tue, 2021-06-01 at 05:46 +1000, Chris Angelico wrote:
> On Tue, Jun 1, 2021 at 5:40 AM David Mertz wrote:
> >
> > I think making 'Ellipsis' a reserved word is too much. The analogy
> > with non-reserved words like `int`, `str`, `map`, `print`, and so
> > on, illustrate this, I think. I.e
El lun, 31 may 2021 a las 12:40, David Mertz () escribió:
> I think making 'Ellipsis' a reserved word is too much. The analogy with
> non-reserved words like `int`, `str`, `map`, `print`, and so on, illustrate
> this, I think. I.e. redefining those is likely to cause bad things to
> happen, but
On Tue, Jun 1, 2021 at 5:40 AM David Mertz wrote:
>
> I think making 'Ellipsis' a reserved word is too much. The analogy with
> non-reserved words like `int`, `str`, `map`, `print`, and so on, illustrate
> this, I think. I.e. redefining those is likely to cause bad things to
> happen, but we'
I think making 'Ellipsis' a reserved word is too much. The analogy with
non-reserved words like `int`, `str`, `map`, `print`, and so on, illustrate
this, I think. I.e. redefining those is likely to cause bad things to
happen, but we're consenting adults, and in the end they are just names.
Howev
On Mon, May 31, 2021 at 4:17 PM Serhiy Storchaka
wrote:
> 31.05.21 17:37, André Roberge пише:
> > For consistency, `Ellipsis` (the name) should **always** refer to the
> > same object that `...` refers to, so that both could not be assigned a
> > new value.
>
> Making Ellipsis a keyword will brea
31.05.21 17:37, André Roberge пише:
> For consistency, `Ellipsis` (the name) should **always** refer to the
> same object that `...` refers to, so that both could not be assigned a
> new value.
Making Ellipsis a keyword will break ast.Ellipsis (and maybe some
third-party libraries).
_
On Mon, May 31, 2021 at 2:40 PM Guido van Rossum wrote:
> Andre, did you have an experience where something related to Ellipsis/...
> confused you? It is not clear to me what exactly prompted you to single out
> Ellipsis (or it’s repr()?)
>
Guido, the reason why I tried is that I am working on a
Andre, did you have an experience where something related to Ellipsis/...
confused you? It is not clear to me what exactly prompted you to single out
Ellipsis (or it’s repr()?)
On Mon, May 31, 2021 at 08:37 André Roberge wrote:
>
>
> On Mon, May 31, 2021 at 12:20 PM MRAB wrote:
>
>> On 2021-05-
On Mon, May 31, 2021 at 12:20 PM MRAB wrote:
> On 2021-05-31 15:55, Paul Bryan wrote:
> > If you're proposing prevention of monkey patching Ellipsis, I think
> > you'll have to go all-in on all builtins.
> >
> > For example:
> >
> str = int
> >
> str
> >
> >
> >
> str == int
> >
>
Fixing typo:
>>> s = str
>>> str = int
>>> str
>>> s
On Mon, 2021-05-31 at 08:31 -0700, Paul Bryan wrote:
> Because ... is still bound to the original Ellipsis. Just as "s"
> below will remain bound to the original str.
>
> >>> s = str
> >>> str = int
> >>> int
>
> >>> s
>
>
> Paul
>
> On
Because ... is still bound to the original Ellipsis. Just as "s" below
will remain bound to the original str.
>>> s = str
>>> str = int
>>> int
>>> s
Paul
On Mon, 2021-05-31 at 16:16 +0100, MRAB wrote:
> On 2021-05-31 15:55, Paul Bryan wrote:
> > If you're proposing prevention of monkey patchi
On 2021-05-31 16:16:59, MRAB wrote:
> If you rebind str to int, the repr of str will say , so you can
> tell that something's happened, but the repr of ... is always 'Ellipsis',
> even though you've rebound Ellipsis.
> >>> Ellipsis is ...
> True
> >>> Ellipsis = str
> >>> Ellipsis is ...
> False
_
On 2021-05-31 15:55, Paul Bryan wrote:
If you're proposing prevention of monkey patching Ellipsis, I think
you'll have to go all-in on all builtins.
For example:
str = int
str
str == int
True
If you rebind str to int, the repr of str will say , so you
can tell that something's ha
If you're proposing prevention of monkey patching Ellipsis, I think
you'll have to go all-in on all builtins.
For example:
>>> str = int
>>> str
>>> str == int
True
Paul
On Mon, 2021-05-31 at 11:37 -0300, André Roberge wrote:
> In Python `...` is referred to as `Ellipsis` and cannot be assigne
In Python `...` is referred to as `Ellipsis` and cannot be assigned to.
Yet, one can assign any value to the name `Ellipsis`.
Consider the following:
```
>>> ...
Ellipsis
>>> ... == Ellipsis
True
>>> Ellipsis
Ellipsis
>>> Ellipsis = 3
>>> Ellipsis
3
>>> ... = 4
File "", line 1
... = 4
^
Have you considered using the JAX library's trick of decorating functions
to provide automatic symbols?
For example, your problem could be done in current Python with an
appropriately-coded library:
@symbolic
def f(x, a, b, c):
return a * x ** 2 + b * x + c
sentinel = Sentinel()
solve(f(
31 matches
Mail list logo