__slots__ in Firehose objetcs

David Malcolm dmalcolm at redhat.com
Fri Jul 5 17:25:54 UTC 2013


On Fri, 2013-07-05 at 17:55 +0200, Matthieu Caneill wrote:
> Every Firehose object uses __slots__ for memory optimization, but it
> blocks tools like SQLAlchemy to add attributes dynamically; could we
> remove this feature or render it optional?

I ran into this myself when trying to write
https://github.com/davidmalcolm/firehose-orm
and commit 453f1944552bdc127b0778b34baa4f1d1c1e6b46 introduced the
Attribute classes to better capture this metadata.

I'm fine with the __slots__ being removed.

(the memory optimization is done for us on CPython 3.3+ and by PyPy.
There's a slight type-safety benefit to having them (since you can't
uses attrs other than those listed, which can help catch typos) - but
the benefit of having an ORM far outweighs these considerations)

Thanks
Dave




More information about the firehose-devel mailing list