[Python-ideas] Re: Double "at" operator for matmul exponentiation

2023-07-05 Thread Dom Grigonis
From perspective of calculation time of matrix multiplications Infix operators is a reasonable solution to define a subset of your own. https://doc.sagemath.org/html/en/reference/misc/sage/misc/decorators.html#sage.misc.decorators.infix_operator The problem is that if one implements it, there

[Python-ideas] Re: "Curated" package repo?

2023-07-04 Thread Dom Grigonis
To have 4) would be great. 2) could be a temporary test pilot to get some ideas when/if 4) was to be implemented. Starting point for 2) could be simple (?). E.g. 4 parts: 1. Features & integration 2. Performance - set-up automatic benchmarking via CI 3. Status (stack hits, user base, open

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-04 Thread Dom Grigonis
> On 2 Jul 2023, at 10:12, Paul Moore wrote: > > On Sun, 2 Jul 2023 at 06:11, Christopher Barker > wrote: > > The OP of this thread is not alone -- folks want an authoritative source > ... > Unfortunately, too much of this discussion is framed as “someone should”,

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Dom Grigonis
Some automation could be done for adding new packages to already existing PRs, where correct addition would integrate nicely, align stats, such as last update, stack trends, benchmarks > On 2 Jul 2023, at 09:36, Christopher Barker wrote: > > On Sat, Jul 1, 2023 at 11:01 PM Chris Angelico

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Dom Grigonis
> >> What’s the worst that can happen? >> > > The less centralized it is, the less bad things can happen. True, but the risk can be minimised if only appropriate cases were streamlined. Only well researched, well defined, unambiguous problems, that depend on mature components of core python

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Dom Grigonis
? 2. What potential 3rd party solutions have you found and how were they lacking? What’s the worst that can happen? > On 1 Jul 2023, at 15:34, Chris Angelico wrote: > > On Sat, 1 Jul 2023 at 22:32, Dom Grigonis wrote: >> >> Another idea, maybe this group could h

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Dom Grigonis
Another idea, maybe this group could host a simple git repo. If idea of extension is reasonable, but it’s not for standard library, open source is not reliable or it's time for consensus and centralisation. Then people can make some PRs, see where it goes. In this case, OP could scan PyPI,

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Dom Grigonis
In my experience, the implementation of bijective dict is largely application specific. 1. Unique-valued dict is fairly straight forward and there is little ambiguity on implementation using 2 dicts. 2. However, if values are not to be unique, then it largely depends on application. (best (as

[Python-ideas] Re: List get/pop

2023-06-16 Thread Dom Grigonis
Just to add. I think same methods would be useful to have for strings as well. > On 14 Jun 2023, at 23:28, Dom Grigonis wrote: > > Yes, > 1. adding keyword argument for `pop` > 2. implementing `get` method as it doesn’t exist at all > * This wouldn’t break anyth

[Python-ideas] Re: List get/pop

2023-06-14 Thread Dom Grigonis
023, at 23:11, Chris Angelico wrote: > > On Thu, 15 Jun 2023 at 06:04, Dom Grigonis wrote: >> So following Chris’ logic... >> If there are 10,000,000 python users on Stack… >> And we assume, that every user encounters such need at least 2 times a year >> (being

[Python-ideas] List get/pop

2023-06-14 Thread Dom Grigonis
Very simple proposal. E.g. ``` >>> l = [‘a’, ‘b’] >>> l.get(0) ‘a’ >>> l.get(2) None >>> l.pop(1, default=‘c’) ‘b’ >>> l.pop(1, default=‘c’) ‘c' ``` Essentially to match them to those of a dict. Current workarounds: ``` try: a = b[n] except IndexError: a = default # and l[index] if

[Python-ideas] Re: Warn when iterating over an already exhausted generator

2023-06-13 Thread Dom Grigonis
natural solution silently give wrong answers is dangerous. > At least having a warning would break the false sense of security. > > I understand that backwards compatibility will probably prevent us from > raising a new error. But a warning could help a lot of people. > >

[Python-ideas] Re: Warn when iterating over an already exhausted generator

2023-06-13 Thread Dom Grigonis
In close to 10 years of experience with python I have never encountered anything like this. If I need to use a list later I never do ANY assignments to it. Why would I? In the last example I would: ``` strings = ['aa', '', 'bbb', 'c’] longest = max(filter(bool, strings), key=len) n_unique =

[Python-ideas] Re: Undefined type

2023-06-12 Thread Dom Grigonis
ou do, seems like a good solution. It > means *you* control what meaning it has in the contexts where it appears. > Best wishes > Rob Cliffe > > On 07/06/2023 17:43, Dom Grigonis wrote: >> This has been bugging me for a long time. It seems that python doesn’t have >&g

[Python-ideas] yield functionality to match that of await

2023-06-12 Thread Dom Grigonis
I was wandering if there are any issues in making `yield` usage to be the same as that of `await` Most importantly: l.append(yield Object()) Nice to have: yield with Object(): yield for i in Object(): Also, could anyone point me in the direction, where it is explained why new await/async

[Python-ideas] Fwd: Explicit encapsulation is better than implicit hardcoding?

2023-06-08 Thread Dom Grigonis
orwarded message: > > From: "Joao S. O. Bueno" > Subject: Re: [Python-ideas] Explicit encapsulation is better than implicit > hardcoding? > Date: 8 June 2023 at 20:36:11 EEST > To: Dom Grigonis > Cc: python-ideas@python.org > > "it's a bit more challenging

[Python-ideas] Fwd: Undefined type

2023-06-08 Thread Dom Grigonis
Thank you all for links. Much appreciated. > Begin forwarded message: > > From: Michael Foord > Subject: Re: [Python-ideas] Re: Undefined type > Date: 8 June 2023 at 17:41:46 EEST > To: david.me...@gmail.com > Cc: Dom Grigonis , python-ideas@python.org > >

[Python-ideas] Undefined type

2023-06-08 Thread Dom Grigonis
This has been bugging me for a long time. It seems that python doesn’t have a convention for “Undefined” type. When I started using python I naturally used None for it (as advised). However, the more I work with python, the more I find that None is a meaningful type. And it is a type that is

[Python-ideas] Explicit encapsulation is better than implicit hardcoding?

2023-06-08 Thread Dom Grigonis
Hey there! I'm curious to know what this group thinks about the implicit design of many Python libraries, both core and open source. What I mean by "implicit design" is when an interface of library is established and initialised at module’s level rather than explicitly encapsulated in classes.

<    1   2