キーとしてフロート、値としてオブジェクトを使用したdictがあります。フロートを受け取りましたが、このフロートが2つのキーの間にあることを知りたいのですが。どうすればこれを見つけることができますか?
コードでの意味の例:
a = {}
a[1.2] = some_unimportant_instance
a[2.3] = some_other_unimportant_instance
a[2.6] = some_third_unimportant_instance
etc...
r = 2.5
# a[r] will not work
# I want something that returns the two numbers around r
# in this case, 2.3 and 2.6.