On Apr 25, 2010, at 7:31 PM, Michael Bayer wrote: > > > > > On Apr 25, 2010, at 1:38 PM, Torsten Landschoff > <[email protected]> wrote: > >> Hi everybody. >> >> After reading the documentation on dictionary based collections at >> <http://www.sqlalchemy.org/docs/mappers.html#dictionary-based-collections>, >> I am wondering if I am the only one who things that this code is intuitive: >> item = Item() >> item.notes['color'] = Note('color', 'blue') >> print item.notes['color'] >> I'd rather write >> item.notes['color'] = Note('blue') >> That the key is stored with the value should be an implementation detail I >> think. >> I extended sqlalchemy.orm.collections.MappedCollection with a few lines to >> implement this (attached). >> >> Shouldn't something like is be included with SQLAlchemy? Or is this a bad id > > You should be able to roll this yourself as a custom dictlike collection > class .
sorry, it seems you've done that already. I'm surprised the existing attribute_mapped_collection doesn't do this already ? > > >> Greetings, Torsten >> >> -- >> DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH >> Torsten Landschoff >> >> Office Dresden >> Tel: +49-(0)351-4519587 >> Fax: +49-(0)351-4519561 >> >> mailto:[email protected] >> http://www.dynamore.de >> >> Registration court: Mannheim, HRB: 109659, based in Karlsruhe, >> Managing director: Prof. Dr. K. Schweizerhof, Dipl.-Math. U. Franz >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sqlalchemy" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/sqlalchemy?hl=en. >> <dictmapping.py> > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
