(original) (raw)
Thank you to everyone who participated (Kirill, Raymond, Nick, Naoki). I've decided there are too many caveats for this approach to be worthwhile and I'm giving up on it.
Kind regards,On Sat, Mar 24, 2018 at 3:18 PM Tin Tvrtković <tinchester@gmail.com> wrote:
Thanks in advance!To make the question simpler, disregard the possibility of custom setters on the attributes.i.e. to replace the instance dictionary altogether. On PyPy, their core devs inform me this is a bad idea because the instance dictionary is special there, so we won't be doing this on PyPy.self.\_\_dict\_\_ = {'a': a, 'b': b, 'c': c}it's faster to do this:self.c = cself.b = bself.a = aI've found that, if a class has more than one attribute, instead of creating an init like this:2) maybe this will find its way into dataclasses if it works out.1) it's a very low level question that I'd really like the input of the core devs on, andHi Python-dev,I'm one of the core attrs contributors, and I'm contemplating applying an optimization to our generated \_\_init\_\_s. Before someone warns me python-dev is for the development of the language itself, there are two reasons I'm posting this here:
But is it safe to do on CPython?