Python dictionaries are unordered.

On Sep 2, 2011, at 11:25 AM, Eduardo wrote:

> Hello,
> I have a query which results (columns id,name) I need to order
> alphabetically by name.
> Then I need to take a slice of the results and to keep them ordered:
> ____________________________________________________________________
> 
> results=somequery.order_by(datab.columns['name'])
> slices=results.slice(start,end)
> res={}
> for slice in slices:
>  res[str(slice[0])]=str(slice[1])
> for id in res.keys():
>  print id, res[id]
> _____________________________________________________
> the print line however does not show that id, name (res[id]) pairs
> ordered alphabetically. Does anyone know why?
> Thanks
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to