
Le 27/03/2016 00:38, Greg Ewing a écrit :
I'm wondering how often literal pathames are really used in actual programs.
In my experience, most pathnames are received as arguments, read from config files, etc. Most literals are just fragments that get concatenated with existing pathnames, and that's already covered by operations between path objects and strings.
That's because you make big programs. I used to think that as well but spending now half of my time as a trainer, I met many other ways to use Python:
- financial analists: load recursively all those csv files in pandas for me please. - biologists : damn where did I put my data again ? ipython => numpy => ok not this one. Not this one. Not this one... - geomaticians : hum, it's too slow, what if I reduce my layers to get only bob shape files ? Let me write that again. - sysadmins : ok let's move all those around, it's becoming a mess here. I'll make real script later to prevent this for happening again. - sunday scipters : oh, I'll reorganize my music today; - students : I don't know what I'm doing, but I know I want to do it in this dir. - testers : what's the f***** ? let me fire a shell to explore this.
Python is not just used by programmers. It's used by 1000 people for whom reconfigurability is a nice to have in the end, but first they want to explore stuff manually and easily.
I've been spending a lot of time in docker containers lately, and a switched a lot between python and bash because Python is still less productive to use for files.
I can see myself in the shell using p'' to replace open, os and the like. Just because it's faster, easier to remember, doesn't require import and it one ".<tab>" away from giving me all I need to manipulate the file. ipython and ptpython already provide completion on file paths.