4 ms·
They’re pretty comparable when the strings are constants. The fun begins when the string is dynamically created.
by jkaptur 8y ago
They’re pretty comparable when the strings are constants. The fun begins when the string is dynamically created.
- mhashemi 8y agoI wouldn't recommend dynamically generating strings. Strings are just a shorthand for Path objects, use Path instead: http://glom.readthedocs.io/en/latest/api.html#specifier-types http://glom.readthedocs.io/en/latest/api.html#specifier-type...
- jkaptur 8y agoI definitely wouldn't recommend it either. Sorry not to be clear. In my experience, it's almost impossible to dissuade people from generating strings if the API affords it. We can't even stop people from generating SQL by concatenation! Musing: does Python have a way (Mypy?) to declare that a method can accept only constant expressions?