Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-26 Thread Kirill Balunov
2018-04-26 13:20 GMT+03:00 Steve Holden : > On Thu, Apr 26, 2018 at 8:56 AM, Steven D'Aprano > wrote: > >> On Thu, Apr 26, 2018 at 03:31:13AM -0400, Terry Reedy wrote: >> > On 4/25/2018 8:20 PM, Chris Angelico wrote: >> > >On Thu, Apr 26, 2018 at 10:11

Re: [Python-Dev] The new and improved PEP 572, same great taste with 75% less complexity!

2018-04-26 Thread Kirill Balunov
2018-04-24 18:31 GMT+03:00 Chris Angelico : > > Recommended use-cases > = > > [...] > > # Capturing regular expression match objects > # See, for instance, Lib/pydoc.py, which uses a multiline spelling > # of this effect > if match :=

[Python-Dev] Dataclasses and correct hashability

2018-02-05 Thread Kirill Balunov
> > On Sun, Feb 4, 2018, 9:50 PM Guido van Rossum > wrote: > > Looks like this is turning into a major flamewar regardless of what I say. > :-( > I really don't want to lose the ability to add a hash function to a > mutable dataclass by

Re: [Python-Dev] Dataclasses and correct hashability

2018-02-05 Thread Kirill Balunov
2018-02-05 20:47 GMT+03:00 Guido van Rossum : > If there's going to be an API for it, it should be in the class, not > something that mutates the class afterwards. > I apologize and don't want to make unnecessary noise. But the already selected design with decorator @dataclass

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Kirill Balunov
Forwarding the reply to the list. Accidentally pressed the wrong button and sent this message personally to Serhiy. Sorry :) ср, 4 июл. 2018 г. в 11:57, Serhiy Storchaka : > > if reductor := dispatch_table.get(cls): > > rv = reductor(x) > > elif reductor := getattr(x, "__reduce_ex__", None):

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-22 Thread Kirill Balunov
2018-04-22 14:10 GMT+03:00 Kirill Balunov <kirillbalu...@gmail.com>: > > Although one of the prerequisites for writing this PEP was the use of the > assignment expression in the lists > Sorry, typo: in compehensions/generators. > it will rarely be used in them,

Re: [Python-Dev] PEP 572: Assignment Expressions

2018-04-22 Thread Kirill Balunov
2018-04-21 4:44 GMT+03:00 Tim Peters : > [Chris Angelico ] > > I don't see much value in restricting the assignment target to names > > only, but if that's what it takes, it can be restricted, at least > > initially. > > I believe this point was made most

Re: [Python-Dev] Replacing self.__dict__ in __init__

2018-03-24 Thread Kirill Balunov
2018-03-24 17:18 GMT+03:00 Tin Tvrtković : > > I've found that, if a class has more than one attribute, instead of > creating an init like this: > > self.a = a > self.b = b > self.c = c > > it's faster to do this: > > self.__dict__ = {'a': a, 'b': b, 'c': c} >

Re: [Python-Dev] Deprecating float.is_integer()

2018-03-22 Thread Kirill Balunov
I apologize that I get into the discussion. Obviously in some situations it will be useful to check that a floating-point number is integral, but from the examples given it is clear that they are very rare. Why the variant with the inclusion of this functionality into the math module was not

Re: [Python-Dev] Deprecating float.is_integer()

2018-03-22 Thread Kirill Balunov
2018-03-22 19:47 GMT+03:00 Tim Peters : > > > Is this functionality so often used and practical to be a method of > float, > > int, ..., and not just to be an auxiliary function? > > > > p.s.: The same thoughts about `as_integer_ratio` discussion. > > I would have added them