questionary
                                
                                
                                
                                    questionary copied to clipboard
                            
                            
                            
                        Add possibility to use List[Choice] in choices parameter of autocomplete
Describe the problem
It will be valuable to have the possibility to use Choice inside the parameter "choices". It will allow for exemple to select a object.
Describe the solution
from questionary.prompts.common import Choice
from questionary import autocomplete
from dataclasses import dataclass
@dataclass
class Object:
    name: str
    value : str
object1 = Object("titre1", "value1")
object2 = Object("titre1", "value1")
choices = [
    Choice(object1.name, value=object1),
    Choice(object2.name, value=object2)
]
autocomplete("select object instance:", choices=choices)
Alternatives considered
No response
@oferveur mhm I am not actually sure if there is something that stands in the way of doing that. happy to take a look, but maybe @kiancross knows if there is an issue with the suggested solution? I think in terms of API / workflow it does fit in quite well.
@tmbo I think the only problem would be deciding what the checked, disabled, and shortcut_key properties of a Choice do in the context of an autocomplete. I do agree that at least being able to set a different title and value would be useful.
Came to see if this functionality existed, consider this a +1 for interest in how we can achieve this