tf2ib icon indicating copy to clipboard operation
tf2ib copied to clipboard

String refactoring - pug.py

Open riking opened this issue 13 years ago • 5 comments

String addition in python creates a new string object every time it happens. As a result, it is inefficient to add any more than two strings together, instead, the format operator should be used. I have converted all the send() calls in pug.py to use string formatting instead of addition, and also added three convenience functions to reduce string constant redundancy.

I did notice many more inefficiencies while looking through the code, and will get to those shortly.

riking avatar Oct 11 '12 00:10 riking

i will have a look at this, but so far the diff doesn't work since all the lines seems to be different. once i get the diff i will see if i can commit those changes.

jdecaron avatar Oct 11 '12 03:10 jdecaron

Shouldn't you be able to push your state to github then hit "implement pull request" then pull on your end? That's how it's supposed to work.

riking avatar Oct 14 '12 22:10 riking

indeed but before applying the change I want to review it but right now when I do the diff it doesn't show me which lines has been changed because every single of them changed. it's making the merge harder for me. I have been a little bit busy lately so I would gladly pull your changes if you would make sure the diff is only giving me the line that got changed.

jdecaron avatar Oct 14 '12 22:10 jdecaron

Oh, I just noticed that the line difference count is huge. I'll go back over my changes, something must be wrong.

riking avatar Oct 16 '12 22:10 riking

The diff appears to be fixed. I edited the file on Windows and forgot to setup the line ending configs. I fixed it on Linux :)

(Hit "files changed", https://github.com/550/tf2ib/pull/28/files , to see what I really changed.)

riking avatar Oct 17 '12 00:10 riking