0
\$\begingroup\$

passing type value to a function on basic of values calculations.

I am doing something like this to calculate and pass new values to funtion .

type = None
draft_id = request.args.get("draft_id")
if draft_id:
   type = 'Draft' 
site_id = request.args.get("site_id")
if site_id:
    type = 'Site'
return get_sites(draft_id, type, *args, **kwargs)

is this good way to do this ? is there any better way to do that ?

New contributor
Shahroz Pervaz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to CR! This seems like too small of a chunk of code to review. Could you show at least a complete route handler function? What's get_sites? Thanks \$\endgroup\$
    – ggorlen
    Nov 21 at 22:54