Open jamesbraza opened 9 months ago
Hi @jamesbraza, why would you like to avoid workaround #2?
Thanks for asking for clarification. I wrote it in the original post, but to restate more concisely, it's to avoid overlap with f-strings:
# Here is an f-string and filter syntax collision, which will lead to a bug
httpx.get(f"/users/?filter{name.icontains}={sub_name}")
# Here is a workaround (requires knowing about the possible collision) to avoid the bug
httpx.get(f"/users/?filter{{name.icontains}}={sub_name}")
# What I am asking for (or something like this): configurability to avoid f-string syntax collision
httpx.get(f"/users/?filter[name.icontains]={sub_name}")
Currently, filter syntax directly overlaps with f-string syntax. This make string building URLs a little more cumbersome:
Can we support an alternate syntax for filter strings, so one can avoid the workarounds? Perhaps
[]