On Mon, Jun 4, 2018 at 11:54 PM, Dan Strohl <d.str...@f5.com> wrote: >> > >> No-one is saying a method is *worse* than a standalone function - they are >> just saying it's *not sufficiently better* to justify creating a string >> method that >> replicates an existing stdlib function. >> > > What about performance? I would expect a string method to perform better > than a stdlib function. (no?) Especially if it's something that could be > used commonly it seems like having that function be of higher performance > would be a benefit? > > At least for me, when I do use this, it's often in places like logging where > it could well be called a lot. >
Considering that a method on a string literal is a plausible candidate for constant folding, it most definitely could perform better; it could perform as well as the string literal itself does. ChrisA -- https://mail.python.org/mailman/listinfo/python-list