On Fri, 2022-03-18 at 09:35 -0700, Guido van Rossum wrote:
> The motivation has been explained already.

In this thread?

> What on earth did your test do that got a speedup by using sets? Was
> it repeatedly checking whether a variable was in a slot? The other
> thing this does is rearrange the order in which slots appear from run
> to run (since set order is affected by hash randomization) and you
> might have gotten lucky with a popular attribute being moved to the
> front, where it's more likely to be in the memory cache already
> (cache lines being 64 bytes and pointers being 8 bytes nowadays).

I created objects in a tight loop, populating attributes, noting the
elapsed time.

> I agree that dicts are a use case to preserve.
> 
> On Fri, Mar 18, 2022 at 08:59 Paul Bryan <pbr...@anode.ca> wrote:
> > You've proposed a "what", but I don't see a "why".
> > 
> > Indeed, it will break some code.
> > 
> > I've been (currently legally) expressing __slots__ as sets, which
> > is arguably more consistent with its purpose, and in testing
> > appeared to perform better than tuples.
> > 
> > So, I would request that you amend the allowed types to include
> > sets.
> > 
> > Also, people are using dicts to provide docstrings on attributes,
> > so that would need to be addressed as well. 
> > 
> > On Fri, 2022-03-18 at 11:42 +0200, Serhiy Storchaka wrote:
> > > 18.03.22 11:29, Serhiy Storchaka пише:
> > > > It will break some code (there are 2 occurrences in the stdlib
> > > > an 1 in 
> > > > scripts), but that code can be easily fixed.
> > > 
> > > Actually it will break more code, because initializing __slots__
> > > with a 
> > > list is pretty common. Maybe restrict it to tuple or list? But
> > > having an 
> > > immutable __slots__ may be more reliable.
> > > 
> > > _______________________________________________
> > > Python-Dev mailing list -- python-dev@python.org
> > > To unsubscribe send an email to python-dev-le...@python.org
> > > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > > Message archived at
> > > https://mail.python.org/archives/list/python-dev@python.org/message/HCZHJN2LSD2NXFLSFAO7VVOMEZRTLDBQ/
> > > Code of Conduct: http://python.org/psf/codeofconduct/
> > 
> > 
> > _______________________________________________
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/python-dev@python.org/message/6AKHUOVUQ2SQRPE4HAGWAEW2VYRKPFCL/
> > Code of Conduct: http://python.org/psf/codeofconduct/

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/YL2SX4TOFSE6U77C6VXEGPERN4V7WVW2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to