One aspect of scripting is being able to throw something together to create a correct solution to an immediate problem. If the proprietary software that you script around takes over 300 Gigs to lay out a CPU and delays are hugely expensive, then I don't want to waste time on optimisations to get around arbitrary limits. It sounds analogous to wanting to move to X bit integers to save a little here and there. If you are thinking of making limits then you might think of what limit say, 4 terabytes of Ram would impose on the smallest object and propose that. Remember, 2020 means trials of 2 chip, 256 thread AMD servers with 500Gigs of ram. Now if I can get Python sub interpreters working on that! Bliss. 😊 On Fri, Dec 6, 2019, 9:37 AM Steven D'Aprano <steve@pearwood.info> wrote:
Although I am cautiously and tentatively in favour of setting limits if the benefits Mark suggests are correct, I have thought of at least one case where a million classes may not be enough.
I've seen people write code like this:
for attributes in list_of_attributes: obj = namedtuple("Spam", "fe fi fo fum")(*attributes) values.append(obj)
not realising that every obj is a singleton instance of a unique class. They might end up with a million dynamically created classes, each with a single instance, when what they wanted was a single class with a million instances.
Could there be people doing this deliberately? If so, it must be nice to have so much RAM that we can afford to waste it so prodigiously: a namedtuple with ten items uses 64 bytes, but the associated class uses 444 bytes, plus the sizes of the methods etc. But I suppose there could be a justification for such a design.
(Quoted sizes on my system running 3.5; YMMV.)
-- Steven _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@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/VIK7QKOR... Code of Conduct: http://python.org/psf/codeofconduct/