New submission from Brandt Bucher <brandtbuc...@gmail.com>:
I recently came across a case where this functionality would be quite useful (parsing complex values from delimited text files). We have PyLong_FromString and PyFloat_FromString, but no PyComplex_FromString (I can't find a reason why it might have been deliberately omitted). I *think* the best current workaround is to use sscanf to parse out two floats, then feed that to PyComplex_FromDoubles, which is non-trivial. Do others support this addition? I imagine we would just use something similar to the _Py_string_to_number_with_underscores call at the end of complex_subtype_from_string in Objects/complexobject.c. ---------- components: C API keywords: easy (C) messages: 387958 nosy: brandtbucher priority: normal severity: normal status: open title: Add PyComplex_FromString type: enhancement versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43376> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com