[Python-ideas] Re: Top Level Await in Python like in Deno

2021-04-15 Thread redradist
Yes I can, but I am taking about to use it without `asyncio.run` Whenever Python in Top-Level faces with await it will wrap calling all top level statement in async function (for example) ___ Python-ideas mailing list -- python-ideas@python.org To

[Python-ideas] Re: Top Level Await in Python like in Deno

2021-03-24 Thread redradist
It is not the same, it will work in interactive mode But I want to run application without interactive mode ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Top Level Await in Python like in Deno

2021-02-06 Thread redradist
I mean to be able to do something like this: ```python import asyncio await asyncio.sleep(1); ``` ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Top Level Await in Python like in Deno

2021-02-06 Thread redradist
Hi all, Deno is JavaScript runtime that has very nice feature like Top Level Await, I think it would be also nice to have such feature in Python, it will make using async/await more convenient What do you think ? Share your ideas lets discuss ... ___

[Python-ideas] Re: Python JIT Compilation Thoughts

2021-01-04 Thread redradist
For me it easier to do with C++, I know C, but with C++ it is more maintainable and easier to add new feature and also easier to refactor ... I am not sure if CPython maintainers team will appropriate that I add C++ in code base ... But I can try, I will try to find time to create small proof

[Python-ideas] Re: Python JIT Compilation Thoughts

2021-01-04 Thread redradist
I have found very nice attempt of JIT for CPython https://github.com/tonybaloney/Pyjion It is working under .NET Runtime, but if it is possible in this project I believe it is possible in CPython as well Also to integrate JIT compilcation now it not so hard because we can use llvm ability for

[Python-ideas] Re: Typed Python execution mode

2020-12-20 Thread redradist
Good design should follow open-close principle from SOLID ... You provide template (standard way to do something) for community and if package can work through this interface that is required all goes good ... In such way community would have the standard way to do something instead of lots of

[Python-ideas] Re: Typed Python execution mode

2020-12-20 Thread redradist
Yes, it is not bad, it is open-close principle from SOLID for good design system ... You provide template (standard way to do something) for community and if package can work through this interface that is required all goes good ... In such way community would have the standard way to do

[Python-ideas] Re: Typed Python execution mode

2020-12-12 Thread redradist
It is not to get something in stdlib, it is simple option in cli )) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/

[Python-ideas] Re: Typed Python execution mode

2020-12-10 Thread redradist
It is also about convenience ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: Typed Python execution mode

2020-12-10 Thread redradist
No, it is not good design choose, because then all type-checker will have different optional and it will be a mess ... It should be done in one place like python ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Typed Python execution mode

2020-12-10 Thread redradist
I do not want to make type-checker a part of CPython, I just what options that will allow to run python with first some type-checker ... For example, you would be able to set default python module for type-checking and if there is not module set for type checking, verify if `mypy` installed and

[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 -, redrad...@gmail.com 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

[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

[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 `

[Python-ideas] Re: Experimental syntax proposal

2020-12-05 Thread redradist
I like this literal syntax !! Can't wait to use it !! ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived

[Python-ideas] Re: Custom keywords (from: Decorators for class non function properties)

2020-08-22 Thread redradist
Actually, I would like to write a proposal ... It would be nice if someone support me with it because I will do it at first time ... ) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Decorators for class non function properties

2020-08-06 Thread redradist
No it is not possible to have something like this: ```python def function(cls): # Where is cls is Neuron class object pass class Neuron: activation = function(Neuron) ``` ___ Python-ideas mailing list -- python-ideas@python.org To

[Python-ideas] Re: Decorators for class non function properties

2020-08-06 Thread redradist
Also instead of making all class as dataclass, it would be possible to make only some properties as instance properties: ```python class Client: bank = Bank() @instance name = Name() print(f'Client.bank is {Client.bank}') client = Client() print(f'client.name is {client.name}') ```

[Python-ideas] Re: Decorators for class non function properties

2020-08-06 Thread redradist
Actually in example: ```python class MyClass: @my_property name = arg class MyClass: def name(self): ... def see_name(self): ... ``` I have done mistake ... of course it will not be like this ... What I wanted to show that @my_property could add more complex

[Python-ideas] Re: Decorators for class non function properties

2020-08-06 Thread redradist
I think a property decorator can be useful, because you consider the simplest case with: ```python class MyClass: @my_property name = arg ``` but consider it can generate the following code: ```python class MyClass: def name(self): ... def see_name(self): ... ```

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread redradist
But I can do the same thing with class methods ... but anyway it was introduced method decorators to simplify development and add extra power ... ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread redradist
It could work if we extend syntax like this: ```python class Neuron: activation # By default creates activation with None value activation = linear_activation(activation) ``` and then we could apply as may decorators as needed: ```python class Neuron: activation # By default creates

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread redradist
Also there is maybe some addition parameter like self: ```python class Neuron: @instance_property activation def __init__(self): # automatically created pass ... def instance_property(name, property, self, *args): # Create property on instance ```

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread redradist
Decorator will do the same thing as general decorator For example it could be implemented like this: ```python class linear_activation: def __init(self, name, property): ... def linear_activation(name, property): ... ``` ___

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread redradist
Disagree, because for example what if I want custom property with two or three decorators ? Like this: ```python class Neuron: @softmax_activation(weights=["w0", "w1"]) @linear_activation activation def __init__(self): self.w0 = [...] self.w1 = [...] ... ```

[Python-ideas] Decorators for class non function properties

2020-08-04 Thread redradist
Hi all, Seems like this topic was previously raised, but what if we add possibility to decorate non function properties in class: ```python class Neuron: @linear_activation activation ``` ___ Python-ideas mailing list --

[Python-ideas] Re: Thoughts about Fast Python Engine and Python EveryWhere

2020-07-16 Thread redradist
I know, I know that PyPy is fast as V8 but PyPy implement the whole library inside and it is not easy to embed it somewhere ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Thoughts about Fast Python Engine and Python EveryWhere

2020-07-16 Thread redradist
My main point is that it would be nice to have just very fast execute engine and all library as integration layer ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Thoughts about Fast Python Engine and Python EveryWhere

2020-07-16 Thread redradist
CPython is portable but due to integrated standard library (builtin functionality) it is hard to evolve it, for examle to add JIT, anyway it is just my thoughts ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Thoughts about Fast Python Engine and Python EveryWhere

2020-07-16 Thread redradist
Recently I have been thinking about why `JavaScript` with it's horrible type system and lots of edge cases has supported so many platform and is very fast ... First answer is simple, because big companies such as Google, Facebook and so on evolve this language and run-time for it ... But it

[Python-ideas] [Feature] Body closure

2020-07-13 Thread redradist
Today I think about lambda in Python and what if we introduce the new syntax: ```python def lock(*args, closure): # Do some stuff closure() # Call closure # Finish stuff if __name__ == '__main__': lock(): # Do some things here is thread safe ``` This feature could be very

[Python-ideas] Re: Python GIL Thoughts

2020-06-30 Thread redradist
Brett Cannon wrote: > It's a discussion issue. PEP 554 is trying to focus on the API of > subinterpreters and doesn't want to distract from that by bringing the GIL > into it. > That being said, the general expectation from everyone involved is there > will be a perl-interpreter GIL. > On Sat, Jun

[Python-ideas] Re: Modularize Python library

2020-06-29 Thread redradist
Steven D'Aprano wrote: > On Mon, Jun 29, 2020 at 10:20:40AM -, redrad...@gmail.com wrote: > > Why I want that ? > > Okay, here are the reasons: > > 1) Security issue, should be fixed as soon as possible without waiting > > 2 months or 1 year for next CPython release > > That is an excellent

[Python-ideas] Re: Python __main__ function

2020-06-29 Thread redradist
Chris Angelico wrote: > On Fri, May 29, 2020 at 5:25 AM Alex Hall alex.moj...@gmail.com wrote: > > > > On Thu, May 28, 2020 at 12:57 PM Paul Sokolovsky pmis...@gmail.com wrote: > > > > > And in all fairness, all good ideas already came > > to somebody else years > > ago. There's

[Python-ideas] Re: Modularize Python library

2020-06-29 Thread redradist
Steven D'Aprano wrote: > On Tue, Jun 16, 2020 at 12:41:58PM -, redrad...@gmail.com wrote: > > As long as I cannot update version of standard > > library package > > separately from CPython version - No, they are not separate creatures > > ;) > > Why would you want to? That just sounds like

[Python-ideas] Re: Modularize Python library

2020-06-29 Thread redradist
Edwin Zimmerman wrote: > This is still true.  There are some of us that will scream very very loud if > the std > lib disappears from Python installers.  However, I think there could easily > be a way to > satisfy both parties here.  How difficult would it be to release both full > and minimal

[Python-ideas] Re: Modularize Python library

2020-06-29 Thread redradist
Paul Moore wrote: > On Tue, 16 Jun 2020 at 11:53, Stéfane Fermigier s...@fermigier.com wrote: > > the "batteries included" argument was a huge selling > > points years ago (when Aaron Watters wrote "Internet Programming With > > Python", for > > instance) but I think the situation has changed

[Python-ideas] Re: Modularize Python library

2020-06-29 Thread redradist
Stephen J. Turnbull wrote: > Edwin Zimmerman writes: > > This is still true.  There are some of us that will > > scream very > > very loud if the std lib disappears from Python installers.  > > However, I think there could easily be a way to satisfy both > > parties here.  How difficult would it

[Python-ideas] Re: Python JIT Compilation Thoughts

2020-06-29 Thread redradist
Ned Batchelder wrote: > On 5/25/20 6:02 AM, redrad...@gmail.com wrote: > > Hi all, > > I do not know maybe it was already discussed ... > > It's been extensively discussed and attempted. > > but the toolchain like LLVM is very mature and it can > > provide the simpler JIT compilation to machine

[Python-ideas] Re: Bringing the print statement back

2020-06-27 Thread redradist
Guido van Rossum wrote: > In Python 3.10 we will no longer be burdened by the old parser (though 3rd > party tooling needs to catch up). > One thing that the PEG parser makes possible in about 20 lines of code is > something not entirely different from the old print statement. I have a >

[Python-ideas] Re: Modularize Python library

2020-06-16 Thread redradist
Rhodri James wrote: > On 16/06/2020 10:23, redrad...@gmail.com wrote: > > I think it would be desired to modularize Python > > library and then to > > provide part of standard library through PyPi It will add possibility > > to evolve separately run-time and standard library > > Uh, aren't the

[Python-ideas] Re: Modularize Python library

2020-06-16 Thread redradist
Rhodri James wrote: > On 16/06/2020 10:23, redrad...@gmail.com wrote: > > I think it would be desired to modularize Python > > library and then to > > provide part of standard library through PyPi It will add possibility > > to evolve separately run-time and standard library > > Uh, aren't the

[Python-ideas] Re: Modularize Python library

2020-06-16 Thread redradist
I like what they `Pycopy` maintainers did !! I allow to evolve separately runt-time and standard library ;) Library maintainer could provide fixes to library faster than waiting one year release cycle of CPython ___ Python-ideas mailing list --

[Python-ideas] Modularize Python library

2020-06-16 Thread redradist
Hi all, me again ... ) I think it would be desired to modularize Python library and then to provide part of standard library through PyPi It will add possibility to evolve separately run-time and standard library I think standard library should be as small as needed and all other functionality

[Python-ideas] Re: String module name

2020-06-16 Thread redradist
Yeah, but it still desire to be solved ... One of the use-cases is if I want to use `Brython`, it will be usable to load the module or entire package from the internet and then to use it in my application ... Issue with the right to access some resources could be solve with flags as `Deno`

[Python-ideas] Re: String module name

2020-06-16 Thread redradist
You cannot trust PyPi either ... I think user should decide if it allows code from arbitrary URL to access filesystem, network or anything else as `wasmtime` and `deno` did ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an

[Python-ideas] String module name

2020-06-15 Thread redradist
What if we introduce the string module: ```python from "https://python.org/some_module.py; import name ... ``` It will add possibility to run code with complex name of module that cannot be presented as set of lexical items and also will allow to load the module from external location

[Python-ideas] Re: Python WebAssembly Support

2020-06-15 Thread redradist
The question is why not to apply all this patches to CPython to be able to compile CPython on the Web ? ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Python WebAssembly Support

2020-06-15 Thread redradist
Thanks, but I know about this implementation ... But my question is why not to apply all this patches to `CPython` to be able to compile `CPython` on the Web ? https://github.com/iodide-project/pyodide https://github.com/dgym/cpython-emscripten Patches to CPython seems pretty straightforward

[Python-ideas] Python WebAssembly Support

2020-06-15 Thread redradist
Hi all, I love Python, but as soon as I need to do something in browser I have to use ugly JavaScript !! Is there any future plans support for compiling CPython to WebAssembly using Emscripten ? ___ Python-ideas mailing list --

[Python-ideas] Re: Python GIL Thoughts

2020-05-29 Thread redradist
I've just share information, relax ;) And also it seems like they have very low overhead with atomic variables Arc ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Python GIL Thoughts

2020-05-29 Thread redradist
Yesterday RustPython team finished threading without GIL: https://github.com/RustPython/RustPython/issues/1831 ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Python __main__ function

2020-05-28 Thread redradist
Cool !! But it disappointed that this proposal was reject ( ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message

[Python-ideas] Python __main__ function

2020-05-28 Thread redradist
Hi all, In Python we often use the following syntax to call the main logic of script when it was ran: ```python def main(): pass # whatever should be done for `python ./script.py` if __name__ == '__main__': main() ``` Maybe it is a time to introduce the new module level function like

[Python-ideas] Re: Python JIT Compilation Thoughts

2020-05-27 Thread redradist
Thanks Guido !! I have not known about `pyston` ... It is pretty good like for me I will take a close look at this project ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Python GIL Thoughts

2020-05-25 Thread redradist
Edwin Zimmerman wrote: > On Monday, May 25, 2020 redrad...@gmail.com [mailto:redrad...@gmail.com] > wrote > > Edwin Zimmerman wrote: > > On 5/25/2020 5:56 AM, redrad...@gmail.com > > wrote: > > Edwin Zimmerman wrote: > > Sub-interpreters are a work in progress. The API is not anywhere near > >

[Python-ideas] Re: Python GIL Thoughts

2020-05-25 Thread redradist
redradist@gmail.com wrote: > Chris Angelico wrote: > > On Mon, May 25, 2020 at 7:58 PM redrad...@gmail.com > > wrote: > > > > > Edwin Zimmerman wrote: > > Only if your workload is CPU bound. Python optimizes IO bound workload > > performance by > >

[Python-ideas] Re: Python GIL Thoughts

2020-05-25 Thread redradist
Chris Angelico wrote: > On Mon, May 25, 2020 at 7:58 PM redrad...@gmail.com > wrote: > > > > Edwin Zimmerman wrote: > > Only if your workload is CPU bound. Python optimizes IO bound workload > > performance by > > releasing the GIL while doing IO. Green threads generally do not offer > > this

[Python-ideas] Re: Python GIL Thoughts

2020-05-25 Thread redradist
Edwin Zimmerman wrote: > On 5/25/2020 5:56 AM, redrad...@gmail.com wrote: > > Edwin Zimmerman wrote: > > Only if your workload is CPU bound. Python optimizes IO bound workload > > performance by > > releasing the GIL while doing IO. Green threads generally do not offer > > this option. > > Real

[Python-ideas] Python JIT Compilation Thoughts

2020-05-25 Thread redradist
Hi all, I do not know maybe it was already discussed ... but the toolchain like LLVM is very mature and it can provide the simpler JIT compilation to machine code functionality and it will improve performance of the Python a lot !! ___ Python-ideas

[Python-ideas] Re: Python GIL Thoughts

2020-05-25 Thread redradist
>> Edwin Zimmerman wrote: Only if your workload is CPU bound. Python optimizes IO bound workload performance by releasing the GIL while doing IO. Green threads generally do not offer this option. Real threads is not needed in Python: 1) Real threads do not work parallel 2) Real threads only

[Python-ideas] Python GIL Thoughts

2020-05-23 Thread redradist
Hi all, I am very exciting about the sub-interpreters ... but I do not like some parts ... Consider the following code: ```python import _xxsubinterpreters as interpreters import threading import textwrap as tw import marshal if __name__ == '__main__': # Create a sub-interpreter