On Tue, 18 Oct 2022 at 03:51, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > > MRAB <pyt...@mrabarnett.plus.com> writes: > >It can't optimise that because, say, 'print' could've been bound to a > >function that rebinds 'str'. > > It would be possible to find out whether a call of a function > named "print" is to the standard function, but the overhead > to do this in the end might slow down the execution. > > In general, it can be possible that there could be optimizer > stages after compilation. So, one might write a small micro- > benchmark to be sure. >
You'd also have to ensure that the stringification of the ID doesn't change (which it can it it isn't a core data type), and the easiest way to do THAT is to call str() on the ID every time and see if it's the same... ChrisA -- https://mail.python.org/mailman/listinfo/python-list