[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@python.org

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

2020-08-04 Thread Chris Angelico
On Tue, Aug 4, 2020 at 6:09 PM wrote: > > 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 > ``` What would that decoration do, exactly?

[Python-ideas] Introduce a boundary parameter for typing.get_type_hints when used with a class object

2020-08-04 Thread Dominik Vilsmeier
In one of my projects I'm reusing class-level type annotations to identify relevant attributes for serialization, e.g. similar to the following: attrs = {name: getattr(obj, name) for name in get_type_hints(type(obj))} This is convenient because it merges the type annotations from the various

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

2020-08-04 Thread Todd
The primary issue I was trying to find a way to reliably and clearly avoid conflicts between the index labels and the positional argument names. So if you have: __getitem__(self, index, **kwargs) You can't have an index label named "index", because it conflicts with the "index" positional argume

[Python-ideas] Changing item dunder method signatures to utilize positional arguments (open thread)

2020-08-04 Thread Ricky Teachey
The following comment is from the thread about adding kwd arg support to the square bracket operator (eg, `Vec = Dict[i=float, j=float]`). On Tue, Aug 4, 2020, 2:57 AM Greg Ewing wrote: On 4/08/20 1:16 pm, Steven D'Aprano wrote: > Why would we want to even consider a new approach to handling key

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

2020-08-04 Thread Jonathan Fine
Thank you all for your posts. I'm busy now and for the next few days, so have little time to respond. Here's some comments and suggestions. I hope that Andras, Caleb, Stefano, Neil, Joao Bueno, Todd and Stephan will take a special interest in this post. In the previous thread, these people saw tha

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-08-04 Thread Todd
On Tue, Aug 4, 2020 at 8:17 AM Ricky Teachey wrote: > The following comment is from the thread about adding kwd arg support to > the square bracket operator (eg, `Vec = Dict[i=float, j=float]`). > > On Tue, Aug 4, 2020, 2:57 AM Greg Ewing > wrote: > > On 4/08/20 1:16 pm, Steven D'Aprano wrote: >

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

2020-08-04 Thread Joao S. O. Bueno
When one needs a custom property, the easy, readable, and that already works way to create then is just to create an instance of the their class and assign the instance to the desired class attribute. All the class have to do is to have the methods that identify it as a descriptor: "__get__" and "_

[Python-ideas] Re: Introduce a boundary parameter for typing.get_type_hints when used with a class object

2020-08-04 Thread David Mertz
This definitely feels to me like though if an oddball case that "write your own function" seems like the best solution. I accept the OP needs it, but I have trouble imagining that many others would. On Tue, Aug 4, 2020, 7:42 AM Dominik Vilsmeier wrote: > In one of my projects I'm reusing class-l

[Python-ideas] Re: Introduce a boundary parameter for typing.get_type_hints when used with a class object

2020-08-04 Thread Guido van Rossum
Maybe get-type-hints can be refactored to make writing such a function simpler. IIRC the part that takes a single annotation and evaluates it is a private function. On Tue, Aug 4, 2020 at 12:57 David Mertz wrote: > This definitely feels to me like though if an oddball case that "write > your own

[Python-ideas] Re: How to prevent shared memory from being corrupted ?

2020-08-04 Thread Marco Sulla
I forgot that there's also Ray: https://github.com/ray-project/ray Ray uses Apache Arrow (and Plasma) under the hood. It seems Plasma was originally developed by Ray team. Don't know how they solve the GC problem. Maybe they disable it. ___ Python-ideas