Another py3 anecdote. We have a service with back-ends. So, on py2 it logs "waiting for [('', 'sdb1')]". On py3 it logs " waiting for <zip object at 0x7fbf55e
d7708>", which is useless for a sysadmin.

@zaitcev I've seen that before, it's lazy evaluation, but the way it's being accessed by the logger isn't forcing it to be evaluated. You can force it to evaluate with list() on that object.

@kazriko Well yea, throwing list() on all sort of objects is the way to go in py3. One subtle thing though, I have to do u=list(zip(x, y)) instead of logger(list(u)), because by the time we're ready to log an error, contents of the zip are already consumed, so yet again the log is useless then.

@zaitcev Yeah, the __repr__() should be a bit more useful on the zip object.

Sign in to participate in the conversation
Arkaic Mastodon

An instance for Kazriko