> Even with tagged pointers, you could just provide a macro that unpacks > the pointer to the buffer for a given string kind.
These macros are indeed available. > I don't think there's > much more to be done to keep up the abstraction. I don't see a reason to > prevent users from accessing the memory buffer directly, especially not > by (accidental, as I understand it) obfuscation through a void*. It's not about preventing them from accessing the representation. It's an "internal public" structure just as all other object layouts (i.e. feel free to use them, but expect them to change with the next release). However, I still think that people rarely will: - most code treats strings as opaque, just as any other PyObject* - code that is aware of strings typically wants them in an encoded form, often UTF-8, or whatever the underlying C library expects. - code that does need to look at individual characters should be fine with the accessor macros. That said, I can readily believe that Cython would have a use for direct access to the structure. I just wouldn't want people to rewrite their code in four versions (three for the different 3.3 representations, plus one for 3.2 and earlier). Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com