New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The "lazy strings" patch #44194
Comments
This patch consists of three changes to CPython:
In detail: PyStringObject.ob_sval was changed from a char[] array "lazy concatenations" change string concatenation ("a" + "b") so that, "lazy slices" changes string slicing ("abc"[1], "a".strip()) so When considering this patch, please keep in mind that the "lazy" changes These changes were implemented almost entirely in With this patch applied, trunk builds and passes all expected tests For a more thorough discussion of this patch, please see the attached |
I really like the idea of the lazy cats, and can believe that it's a really good optimisation, but before I review this code properly I'd like to see: |
Howdy! Much has transpired since I posted this patch.
Is there life after Guido patch-closing? I'd be happy to spend the time answering your questions if my patch had some sort of future. (Though you'll have to tell me what you mean by "break strict aliasing".) |
Hi Larry, By strict aliasing, I just meant it's illegal to access members of one type if the object is of a different (incompatible) type (actually I was wrong, this isn't the strict aliasing rule - it's a more fundamental one). In your case, it means it's illegal to pass a concat object where a string object is expected, even if the function accesses members that are common to them both. If this is happening, the answer is to make a union with the string object and cat object as members, and to use this union type instead but it's not pretty. I suggest this patch is closed anyway. If you still believe in your code and think that lazy string cats have support, I suggest making a new patch with just those in (fixed up to be correct C, and PEP-7 compliant). |
I'm raising the level to draw more attention to this featue. It should |
ISTM that 2.x won't receive this kind on enhancement anymore. Collin, I'm adding you to the nosy list because you may be interested in |
Either this bug or bpo-1569040 should be closed as duplicate of the other |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: