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

2018-03-25 Thread Raymond Hettinger
On Mar 25, 2018, at 8:08 AM, Tin Tvrtković wrote: > > That's reassuring, thanks. I misspoke. The object size is the same but the underlying dictionary loses key-sharing and doubles in size. Raymond ___ Python-Dev mailing list

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

2018-03-25 Thread INADA Naoki
> > The dict can be replaced during __init__() and still get benefits of > key-sharing. That benefit is lost only when the instance dict keys are > modified downstream from __init__(). So, from a dict size point of view, > your optimization is fine. > I think replacing __dict__ lose

Re: [Python-Dev] Use more Argument Clinic Annotations?

2018-03-25 Thread Larry Hastings
On 03/25/2018 09:58 AM, Serhiy Storchaka wrote: 25.03.18 19:47, Dave Halter пише: Is there a way though in which the __text_signature__ could contain the information `-> str` or do we need to engineer that first? There is no such way currently. Are you sure?  I'm pretty sure Argument

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

2018-03-25 Thread Dan Stromberg
On Sun, Mar 25, 2018 at 9:51 AM, Serhiy Storchaka wrote: > 25.03.18 18:38, Tin Tvrtković пише: >> >> For example, for a simple class with 9 attributes: > What are results for classes with 2 or 100 attributes? What are results in > Python 3.5? > > I think you are playing on

Re: [Python-Dev] Use more Argument Clinic Annotations?

2018-03-25 Thread Serhiy Storchaka
25.03.18 19:47, Dave Halter пише: Is there a way though in which the __text_signature__ could contain the information `-> str` or do we need to engineer that first? There is no such way currently. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Use more Argument Clinic Annotations?

2018-03-25 Thread Dave Halter
2018-03-25 18:38 GMT+02:00 Serhiy Storchaka : > 25.03.18 15:36, Dave Halter пише: >> >> I recently started testing Jedi with Python 3.7. Some tests broke. I >> realized that one of the things that changed in 3.7 was the use of >> argument clinic in methods like str.replace. >>

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

2018-03-25 Thread Serhiy Storchaka
25.03.18 18:38, Tin Tvrtković пише: For example, for a simple class with 9 attributes: What are results for classes with 2 or 100 attributes? What are results in Python 3.5? I think you are playing on thin ice. Your results depend on implementation details of the bytecode (in particularly

Re: [Python-Dev] Use more Argument Clinic Annotations?

2018-03-25 Thread Serhiy Storchaka
25.03.18 15:36, Dave Halter пише: I recently started testing Jedi with Python 3.7. Some tests broke. I realized that one of the things that changed in 3.7 was the use of argument clinic in methods like str.replace. The issue is that the text signature doesn't contain a return annotation.

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

2018-03-25 Thread Tin Tvrtković
On Sun, Mar 25, 2018 at 5:23 AM Nick Coghlan wrote: > That depends on what you mean by "safe" :) > > It won't crash, but it will lose any existing entries that a metaclass, > subclass, or __new__ method implementation might have added to the instance > dictionary before

[Python-Dev] Use more Argument Clinic Annotations?

2018-03-25 Thread Dave Halter
Hi Python Devs I recently started testing Jedi with Python 3.7. Some tests broke. I realized that one of the things that changed in 3.7 was the use of argument clinic in methods like str.replace. The issue is that the text signature doesn't contain a return annotation. >>>

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

2018-03-25 Thread Tin Tvrtković
That's reassuring, thanks. On Sat, Mar 24, 2018 at 5:20 PM Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > This should work. I've seen it done in other production tools without any > ill effect. > > The dict can be replaced during __init__() and still get benefits of > key-sharing.