[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-04 Thread Sebastian Berg
On Mon, 2022-04-04 at 09:14 -0700, Ken Kundert wrote: > As why it is naive, see my previous post where I talk about the > limitations of dimensional analysis. > > As a point of reference, I have been developing software for > electrical engineers for over 40 years.  That software uses physical > q

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-24 Thread Sebastian Berg
On Mon, 2021-10-25 at 03:47 +1100, Chris Angelico wrote: > On Mon, Oct 25, 2021 at 3:43 AM Jonathan Fine > wrote: > > > > Hi > > > > Please forgive me if it's not already been considered. Is the > > following valid syntax, and if so what's the semantics? Here it is: > > > >     def puzzle(*, a=

[Python-ideas] Re: NAN handling in statistics functions

2021-08-27 Thread Sebastian Berg
On Sat, 2021-08-28 at 11:49 +1000, Steven D'Aprano wrote: > On Tue, Aug 24, 2021 at 01:53:51PM +1000, Steven D'Aprano wrote: > > > I've spoken to users of other statistics packages and languages, > > such as > > R, and I cannot find any consensus on what the "right" behaviour > > should > > be f

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-23 Thread Sebastian Berg
On Mon, 2021-08-23 at 13:51 +, Thomas Grainger wrote: > In all seriousness this is an actual problem with numpy/pandas arrays > where: > > line 1537, in __nonzero__ >     raise ValueError( > ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, > a.bool(), a.item(), a.any()

[Python-ideas] Re: weakref.link: Keep A alive while B is alive (and/or update WeakKeyDictionary)

2021-07-19 Thread Sebastian Berg
On Mon, 2021-07-19 at 22:24 +, Mark Gordon wrote: > Proposal: > > Have a weakref.link (not at all attached to the naming) primitive > that allows one to keep object A alive while object B is alive. This > would be functionally similar to adding A as an attribute of B from > the GC's perspectiv

[Python-ideas] Re: Flatten function (was: Deprecate sum of lists)

2021-06-20 Thread Sebastian Berg
On Sun, 2021-06-20 at 13:48 -0400, David Mertz wrote: > On Sun, Jun 20, 2021 at 1:07 PM Christopher Barker < > python...@gmail.com> > wrote: > > > Flatten is used in numpy: > > Where it is a method, and goes all the way to one dimension. > > > > I think it's worth keeping in mind the differences

[Python-ideas] Re: Iterable scalar values returning itself ones?

2021-04-13 Thread Sebastian Berg
On Tue, 2021-04-13 at 17:00 +0200, Hans Ginzel wrote: > Are there any reasons not to make scalar types iterable returning the > value ones? > Should each function check if it has got one value or a list/tuple > before iteration over the argument? > What is wrong on scalars for iteration, please? >

[Python-ideas] Re: Question about binary dunder deferring logic

2020-12-03 Thread Sebastian Berg
On Thu, 2020-12-03 at 13:10 -0600, Sebastian Berg wrote: > Hi all, > > I just sniped myself wondering about how correct dispatching for > dunders works for independently derived subclasses. Sorry, this was likely mostly noise... I had forgotten about the asymmetry in `__add__` and `

[Python-ideas] Question about binary dunder deferring logic

2020-12-03 Thread Sebastian Berg
Hi all, I just sniped myself wondering about how correct dispatching for dunders works for independently derived subclasses. This is an extreme corner case where two subclasses may not know about each other, and further cannot establish a hierarch: class A(int): pass class B(int

[Python-ideas] Re: PEP 472 - regarding d[x=1, y=2] and similar

2020-08-16 Thread Sebastian Berg
On Sun, 2020-08-16 at 12:07 -0700, Guido van Rossum wrote: > On Sun, Aug 16, 2020 at 5:45 AM Steven D'Aprano > wrote: > > > On Mon, Aug 17, 2020 at 12:32:08AM +1200, Greg Ewing wrote: > > > On 16/08/20 11:49 am, Guido van Rossum wrote: > > > >SEMANTICS OF NO ARGUMENTS > > > >I can see two

[Python-ideas] Re: PEP 472 -- Support for indexing with keyword arguments

2020-07-21 Thread Sebastian Berg
On Mon, 2020-07-20 at 22:27 -0700, Christopher Barker wrote: > On Mon, Jul 20, 2020 at 3:17 AM Rhodri James > wrote: > > > Ironically that example pushes me back to -1. It may look a lot > > like > > xarray and pandas working, but that just means it should be in > > xarray > > and/or pandas. >

[Python-ideas] Re: Keyword arguments self-assignment

2020-04-23 Thread Sebastian Berg
On Thu, 2020-04-23 at 14:47 -0400, Kyle Lahnakoski wrote: > I reviewed my code: of 20,360 keyword arguments, 804 (4%) are have > the > x=x format. I do not know if this is enough to justify such a > proposal, Is that script somewhere? I got a bit curious and wasted some time on making my own

[Python-ideas] Re: Keyword arguments self-assignment

2020-04-17 Thread Sebastian Berg
On Thu, 2020-04-16 at 21:21 -0700, Andrew Barnert via Python-ideas wrote: > On Apr 16, 2020, at 20:48, oliveira.rodrig...@gmail.com wrote: > > In Javascript ES6 they don't have sets built like python so `{}` > > always refers to objects being constructed. It does indeed support > > implicit key: va

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-02-23 Thread Sebastian Berg
On Sun, 2020-02-23 at 20:32 +, jdve...@gmail.com wrote: > Kyle Stanley wrote: > > In order for this proposal to be seriously considered, I think it's > > necessary to cite many realistic examples where the current > > behavior is > > existing solutions, I strongly suspect that this is going to