scipy.optimize.least_squares for more than one dimension?

2023-06-30 Thread Martin Schöön via Python-list
Yesterday I wanted to move from optimize.leastsq to 
least_squares. I have data depending on four variables
and want to fit a function in four variables to this
data. This works with leastsq but not with least_squares.

Am I trying to do something least_squares is not capable
of?

Disclaimer: I was burning midnight oil...

TIA

/Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


from __future__ import annotations bug?

2023-06-30 Thread Joseph Garvin via Python-list
```
from __future__ import annotations
from typing import Generic, TypeVar

T = TypeVar("T")
class Foo(Generic[T]): ...
class Bar(Foo[Buzz]): ... # NameError here
class Buzz: ...
```

This will error, despite the __future__ import, because cpython is trying
to look up Buzz before it's defined, even though we have supposedly
prevented annotations from being processed. I realize that Class[Args] is
allowed in that area in general and isn't always type annotation related,
but does this mean that even with PEP 649 that forward references will
still be needed?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: from __future__ import annotations bug?

2023-06-30 Thread Joseph Garvin via Python-list
Should mention this also affects Protocol[Buzz]

On Fri, Jun 30, 2023, 5:35 PM Joseph Garvin  wrote:

> ```
> from __future__ import annotations
> from typing import Generic, TypeVar
>
> T = TypeVar("T")
> class Foo(Generic[T]): ...
> class Bar(Foo[Buzz]): ... # NameError here
> class Buzz: ...
> ```
>
> This will error, despite the __future__ import, because cpython is trying
> to look up Buzz before it's defined, even though we have supposedly
> prevented annotations from being processed. I realize that Class[Args] is
> allowed in that area in general and isn't always type annotation related,
> but does this mean that even with PEP 649 that forward references will
> still be needed?
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: from __future__ import annotations bug?

2023-06-30 Thread Inada Naoki via Python-list
> but does this mean that even with PEP 649 that forward references will
> still be needed?

Yes. Both of PEP 563 and PEP 649 solves not all forward reference issues.

-- 
Inada Naoki  
-- 
https://mail.python.org/mailman/listinfo/python-list