[Python-ideas] Re: [RFC] "Strict execution mode" (TL;DR version)

2020-12-06 Thread Paul Sokolovsky
Hello, (As the thread continues, and goes from "why did you do that" to actual technical details/implication, I have little choice (if to maintain coherent discussion) but go thru existing posts looking into technical aspects of the proposal.) On Wed, 2 Dec 2020 10:42:25 +1100 Steven D'Aprano w

[Python-ideas] Re: [RFC] "Strict execution mode" (TL;DR version)

2020-12-06 Thread Paul Sokolovsky
Hello, On Wed, 2 Dec 2020 21:15:22 +1100 Steven D'Aprano wrote: [First part was answered previously.] > > > Is monkey-patching disallowed because `mod.func1` is defined as a > > > constant? > > > > What "disallowed" do you mean? The example above clearly says > > "Leads to a warning". At "r

[Python-ideas] Re: [RFC] "Strict execution mode" (TL;DR version)

2020-12-06 Thread Paul Sokolovsky
Hello, On Sat, 05 Dec 2020 21:48:53 -0800 Brendan Barnwell wrote: > On 2020-12-05 05:49, Paul Sokolovsky wrote: > > For that I would need to use RPython. I considered that circa 5 > > years ago, and of course explored it. I "liked" what I saw, sure. > > But I "wasn't happy" with what I saw. > >

[Python-ideas] Typed Python execution mode

2020-12-06 Thread redradist
It would be nice to have "Typed Python" mode that will look like this: ```bash #!/usr/bin/env bash set -e python -m mypy $1 python $1 ``` https://gist.github.com/redradist/dd7253a55081a4dc13fdf3f1549f43b5 It could be achieved by adding special flag like `-t` (typed) _

[Python-ideas] Re: Typed Python execution mode

2020-12-06 Thread redradist
Also if such mode would exsist, it would be nice to have special keywords for such mode like `protocol` Instead of writing: ```python class MathType(Protocol): def reduce(self, *args) -> int: ... ``` it woulb be nicer to have special syntax: ```python-mypy protocol MathType: def re

[Python-ideas] Re: Typed Python execution mode

2020-12-06 Thread Steven D'Aprano
On Sun, Dec 06, 2020 at 10:22:53AM -, [email protected] wrote: > It would be nice to have "Typed Python" mode that will look like this: > > ```bash > #!/usr/bin/env bash > > set -e > python -m mypy $1 > python $1 > ``` What does that mean? Why is it a bash script? > It could be achieved b

[Python-ideas] Re: Typed Python execution mode

2020-12-06 Thread redradist
Steven D'Aprano wrote: > On Sun, Dec 06, 2020 at 10:22:53AM -, [email protected] wrote: > > It would be nice to have "Typed Python" mode that > > will look like this: > > #!/usr/bin/env bash > > > > set -e > > python -m mypy $1 > > python $1 > > > > What does that mean? Why is it a bash scr

[Python-ideas] Re: Typed Python execution mode

2020-12-06 Thread Steven D'Aprano
On Sun, Dec 06, 2020 at 11:25:32AM -, [email protected] wrote: > It would be good to have direct support from python to run script in > typed mode or not ... Python can support other type checker with some > option `--type-checker= or ` of module that will > type-check You already have d

[Python-ideas] Re: Make for/while loops nameable.

2020-12-06 Thread Stephen J. Turnbull
David Mertz writes: > It's cute. Cute is for bunnies and Ghibli anime. :-) > And really quite readable. But it's not writeable. Heh. They look like misplaced apostrophes on my screen in my English buffers. I'd have to go to a 1.3x (maybe 1.5x) font to be sure what I'm looking at. And I'm