[Python-Dev] adding a bytes sequence type to Python

Skip Montanaro skip at pobox.com
Thu Aug 12 21:19:22 CEST 2004


    >> This is the approach taken in the other languages: Everytime the
    >> array display is executed, a new array is created. There is then no
    >> problem with that being mutable.

    Guido> The downside of that is that then for performance reasons you
    Guido> might end up having to move bytes literals out of expressions if
    Guido> they are in fact used read-only (which the compiler can't know
    Guido> but the user can).

Wouldn't the compiler be able to tell it was to be treated specially if it
saw b"GET"?  In that case, the code generated for

    x = b"GET"

would be something like

    LOAD_CONST     "GET"
    LOAD_NAME      bytes
    CALL_FUNCTION  1
    STORE_FAST     x

Skip


More information about the Python-Dev mailing list