On Wed, Dec 21, 2022 at 9:35 AM Chris Angelico <ros...@gmail.com> wrote:

> From the look of things, PyUnicode_Join (the internal function that
> handles str.join()) uses a lot of "reaching into the data structure"
> operations for efficiency. It uses PyUnicode_Check (aka "isinstance(x,
> str)") rather than PyUnicode_CheckExact (aka "type(x) is str") and
> then proceeds to cast the pointer and directly inspect its members.
>
> As such, I don't think UserString can ever truly be a str,


I had figured subclasses of str wouldn’t be full players in the C code —
but join() us pretty fundamental:-(

-CHB
-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/C2HG3QJOU5SLU536CGOJ26VKXVEBZYBH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to