Skip to main content

Parse `funcname`, `args`, `kargs` from function-like string

Project description


Parse funcname, args, kargs from function-like string


pip install funcparse


from funcparse import parse

funcname, args, kwargs = parse('say(1, 2, "Hello", a=1, b=2, c="World")')

# >>> 'say'

# >>> (1, 2, 'Hello')

# >>> {'a': 1, 'b': 2, 'c': 'World'}


It cannot parse another object(i.e. dict) with ‘=’ args in it as follows.

from funcparse import parse

# Raise Syntax Error
# Use {"from": "a", "to": "b"} instead.
funcname, args, kwargs = parse('hi(dict(from="a", to="b"))')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for funcparse, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size funcparse-1.0.2.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page