[Python-ideas] Re: On blessed abuse of operators [was: Changing item dunder ...]

2020-09-02 Thread Stephen J. Turnbull
Chris Angelico writes: > Possibly a better example would be path division in Python, I would have chosen '+' for that operation for the same reason '+' "just works" for sequences. It's a very specialized use case but 5 * pathlib.Path('..') / "foo" makes sense as an operation but oh, the

[Python-ideas] Re: Ensuring that a package is available.

2020-09-02 Thread Michael Smith
On Wed, Sep 2, 2020 at 20:48 Charles Machalow wrote: > I may be in the minority, but sometimes it seems like having to spin up a > venv, etc. to run a small script could be a little bit much. > > > > What if we have something like this POC I wrote: > https://pypi.org/project/pyensure/ > > > > We

[Python-ideas] Ensuring that a package is available.

2020-09-02 Thread Charles Machalow
I may be in the minority, but sometimes it seems like having to spin up a venv, etc. to run a small script could be a little bit much. What if we have something like this POC I wrote: https://pypi.org/project/pyensure/ We could have a switch or python interpreter argument to have packages get

[Python-ideas] Decimal - official !!!

2020-09-02 Thread dust dimka
Rus: "Также любителям бухгалтерии тоже Decimal просто необходим. Я вот думаю Гвидо(создателю питона) надо ввести обозначение для децималов например 'D'.А то вот float есть x = 0.012f, а для децималов было бы удобно x = 0.012D или x = 0.012d...Причем если в выражении есть децимал то все float int

[Python-ideas] Re: Proposed new syntax for subscripting (was PEP 472)

2020-09-02 Thread Guido van Rossum
On Wed, Sep 2, 2020 at 4:23 AM Steven D'Aprano wrote: > On Wed, Sep 02, 2020 at 12:55:43PM +1200, Greg Ewing wrote: > > On 2/09/20 3:44 am, Steven D'Aprano wrote: > > >(9) Keyword-only subscripts are permitted: > > > > > > obj[spam=1, eggs=2] > > > # calls type(obj).__getitem__(spam=1,

[Python-ideas] Re: Proposed new syntax for subscripting (was PEP 472)

2020-09-02 Thread Steven D'Aprano
On Wed, Sep 02, 2020 at 12:55:43PM +1200, Greg Ewing wrote: > On 2/09/20 3:44 am, Steven D'Aprano wrote: > >(9) Keyword-only subscripts are permitted: > > > > obj[spam=1, eggs=2] > > # calls type(obj).__getitem__(spam=1, eggs=2) > > > > del obj[spam=1, eggs=2] > > # calls

[Python-ideas] Re: Proposed new syntax for subscripting (was PEP 472)

2020-09-02 Thread Steven D'Aprano
On Tue, Sep 01, 2020 at 09:04:31AM -0700, Christopher Barker wrote: > The set case is non-trival (which you do discuss later), but could you > provide an example or two here as well? > > I think: > > obj[foo, bar, spam=1, eggs=2] = a_value > # calls type(obj).__getitem__((foo, bar),

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-09-02 Thread Ricky Teachey
On Wed, Sep 2, 2020, 12:19 AM Christopher Barker wrote: > I may get a chance to look carefully at this in a bit, but for now: > > On Tue, Sep 1, 2020 at 6:38 PM Ricky Teachey wrote: > >> Sorry for all the replies but I'm honestly very unsure how do this >> correctly under Steven's proposal. >>

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-09-02 Thread Stefano Borini
On Wed, 2 Sep 2020 at 05:20, Christopher Barker wrote: > And, in fact, the current sytax is pretty tricky as well. Say you want to > make a class that takes multiple indices -- like a Mtraix, for instance. > > your __getitem__ looks like: > > def __getitem__(self, index): > > as they all do. But