Take the following code for instance:
def facebook_sync_album(album_id, thumbnails_only=False):
args = {'fields':'id,images,source'}
if thumbnails_only:
args['limit'] = ALBUM_THUMBNAIL_LIMIT
response = facebook_graph_query(album_id, 'photos', args=args)
Instead I was wondering if something similar to the following is possible:
def facebook_sync_album(album_id, thumbnails_only=False):
photo_limit_arg = {'limit': ALBUM_THUMBNAIL_LIMIT} if thumbnails_only else None
response = facebook_graph_query_by_user_profile(album_id, 'photos', args={'fields':'id,images,source', photo_limit_arg})
So instead needing to predefine args
in order to add an optional element (limit
) I could instead pass a variable which expands to a value:key. Somewhat similar to the way you can expand a dict to kwargs using `kwargs
Is this possible?