__slots__ in Firehose objetcs

Matthieu Caneill matthieu.caneill42 at gmail.com
Mon Jul 8 09:01:31 UTC 2013


On Fri, Jul 5, 2013 at 7:34 PM, Matthieu Caneill
<matthieu.caneill42 at gmail.com> wrote:
> On Fri, Jul 5, 2013 at 7:25 PM, David Malcolm <dmalcolm at redhat.com> wrote:
>> 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)
>
> OK, cool!
> Thank you :-)

Pull request done here:
https://github.com/fedora-static-analysis/firehose/pull/18

Cheers.

Matthieu


More information about the firehose-devel mailing list