pauleveritt / fdom

Template engine based on tag strings and functional ideas.
0 stars 0 forks source link

Duplicate usage of convert_to_proposed_scheme #17

Open pauleveritt opened 11 months ago

pauleveritt commented 11 months ago

The html function starts with:

def html(*args: Chunk | Thunk) -> str:
    args = convert_to_proposed_scheme(*args)
    keyed_args = make_key(*args)

But the first line of make_key re-runs convert_to_proposed_scheme:

def make_key(*args: Chunk | Thunk) -> tuple[Chunk | KeyThunk, ...]:
    args = convert_to_proposed_scheme(*args)
jimbaker commented 11 months ago

Apparently I must have been thinking about this at some point based on this code in https://github.com/pauleveritt/fdom/blob/main/src/fdom/taglib.py#L32, but I have no memory of it 😁

            case Chunk() | Thunk():
                # ignore previous conversions for simplicity
                proposed_args.append(arg)

I like the proposed scheme, and in part I wrote this code to justify it.