On Fri, Apr 8, 2016 at 5:26 AM, Paul Rubin <no.email@nospam.invalid> wrote: > Chris Angelico <ros...@gmail.com> writes: >> First off, what does it actually *mean* to have a tree with numbers >> and keys as strings? Are they ever equal? Are all integers deemed >> lower than all strings? Something else? > > If the AVL tree's purpose is to be an alternative lookup structure to > Python's hash-based dictionaries, then it doesn't really matter what the > ordering between values is, as long as it's deterministic.
Fair enough. In that case, the option of sorting by (obj.__type__.__name__, obj) will probably do the job. But if you need to maintain relationships across types (eg 1 < 2.0 < 3), it needs to be more sophisticated. ChrisA -- https://mail.python.org/mailman/listinfo/python-list