This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brandtbucher
Recipients brandtbucher
Date 2021-03-02.19:49:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614714591.46.0.224854150713.issue43376@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-03-02 19:49:51brandtbuchersetrecipients: + brandtbucher
2021-03-02 19:49:51brandtbuchersetmessageid: <1614714591.46.0.224854150713.issue43376@roundup.psfhosted.org>
2021-03-02 19:49:51brandtbucherlinkissue43376 messages
2021-03-02 19:49:51brandtbuchercreate