sounds like a bug.  add a ticket and/or create a patch !  thanks.

On Jun 2, 3:48 pm, Eric Ongerth <[EMAIL PROTECTED]> wrote:
> I noticed that if you pop() an item out of an OrderedDict, then ask
> the OrderedDict for its values(), you get a key error because the OD
> doesn't trim its ._list when the pop() occurs.
>
> Is this by design?
>
> (demonstration below)
>
> >>> import sqlalchemy
> >>> from sqlalchemy.util import OrderedDict
>
> >>> od=OrderedDict()
> >>> od.update({'id':3L})
> >>> od.update({'mfr':'BD','model_name':'Stigma'})
> >>> od
>
> {'mfr': 'BD', 'id': 3L, 'model_name': 'Stigma'}
>
> >>> od.values()
>
> [3L, 'BD', 'Stigma']
>
> >>> od.pop('id')
>
> 3L
>
> >>> od
>
> {'mfr': 'BD', 'model_name': 'Stigma'}
>
> >>> od._list
>
> ['id', 'mfr', 'model_name']
>
> >>> od.values()
>
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>   File "H:\Python25\lib\site-packages\sqlalchemy\lib\sqlalchemy
> \util.py", line 243, in values
>     return [self[key] for key in self._list]
>   File "H:\Python25\lib\site-packages\sqlalchemy\lib\sqlalchemy
> \util.py", line 270, in __getitem__
>     return dict.__getitem__(self, key)
> KeyError: 'id'


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to