Code review comment for lp:~bladernr/checkbox/949435-remove-hard-coded-paths

Jeff Lane (bladernr) wrote :

> In `xrandr_cycle`, I don't like much the line in which `my_path` is being
> assigned because:
>
> - is defined in line 20 and not used until line 87

Good point there... moved it.

> - the name isn't very descriptive

renamed in both scripts to script_home

> - I'm not sure why `os.path.split(<whatever>)[0]` is used instead of
> `os.path.dirname`
> (even if it contains another call to `os.path.dirname`)

bladernr@klaatu:~/development/949435-remove-hard-coded-checkbox-vars/scripts$ ./xrandr_cycle
path.realpath : /home/bladernr/development/949435-remove-hard-coded-checkbox-vars/scripts/xrandr_cycle
path.dirname : /home/bladernr/development/949435-remove-hard-coded-checkbox-vars/scripts
path.split : ('/home/bladernr/development/949435-remove-hard-coded-checkbox-vars', 'scripts')

ultimately,

os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]

does exactly the same thing as

os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

but looks a bit cleaner, IMHO.

« Back to merge proposal