<#2999 [Core feature] Add support native python ty...
# flytekit
a
#2999 [Core feature] Add support native python type in the condition task Issue created by pingsutw Motivation: Why do you think this is important? For now, The variable in the
_if
in the
condition
must be a promise, and can't use a native python type in the if statement.
Copy code
@dynamic
def d1() -> bool:
    a = t1()
    return (
        conditional("train_estimator")
        .if_(a==True)
        .then(t2())
        .else_()
        .then(t2()))
Copy code
@dynamic
def d1(a: bool) -> bool:
    return (
        conditional("train_estimator")
        .if_(a==True)  # <- failed because the a isn't a promise
        .then(t2())
        .else_()
        .then(t2()))
Goal: What should the final outcome look like, ideally? Both promise and native python types should be supported in the conditions Describe alternatives you've considered Users must create a task to convert it to a promise and use it in the conditions.
Copy code
@task
def convert_to_promise(a: bool) -> bool:
    return a
Propose: Link/Inline OR Additional context https://flyte-org.slack.com/archives/CREL4QVAQ/p1666110935856779 Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte