Hey #python people! Question for you, does anyone know any more details of how the str.split() method is implemented? I'm curious about performance of str.split('.').pop() vs str[str.rfind('.'):] (as in, find the (last part of) extension of a filename) Or maybe there's an even better solution?
Notices by Rebecca :blobcatcomfygamer: (rebeccasaurus@tech.lgbt)
-
Rebecca :blobcatcomfygamer: (rebeccasaurus@tech.lgbt)'s status on Wednesday, 30-Nov-2022 17:15:40 CET Rebecca :blobcatcomfygamer:
-
Rebecca :blobcatcomfygamer: (rebeccasaurus@tech.lgbt)'s status on Wednesday, 30-Nov-2022 17:15:39 CET Rebecca :blobcatcomfygamer:
@stolas_mk2 the current version uses regex, very unnecessarily, to pull out info from every single input line.. (it was my very first python script, don't judge me! :blobcatmeltcry: )
-
Rebecca :blobcatcomfygamer: (rebeccasaurus@tech.lgbt)'s status on Wednesday, 30-Nov-2022 17:15:39 CET Rebecca :blobcatcomfygamer:
@stolas_mk2 ooh, well that's certainly very very convenient at least! I might have to set up some tests to measure the performance..
It's for a script I've written to use at work, parsing potentially millions of lines of output from "find ..." (shell, not python) and summarizing some data. I doubt the performance difference would be particularly large, I just prefer to write efficient code xD