SilentGhost added the comment:

bytearray is a mutable object and the behaviour is compatible with behaviour of 
any mutable object in Python. You're passing a into the yuke_bpe function and 
the original object is being modified (emptied) there. To work around this you 
could copy the object within the functioin and carry out transformations on the 
copied object.

----------
nosy: +SilentGhost
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: About bytearray -> bytearray changes when function mutates it
type:  -> behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27651>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to