python-virtualenvwrapper / virtualenvwrapper

Other
122 stars 17 forks source link

Rename variable a to __a or similar? #102

Open mandarm opened 2 months ago

mandarm commented 2 months ago

The virtualenvwrapper.sh shell assigns to a as a variable in 4 lines: 430 712 1111 1218 (as far as I can tell).

I use a as a variable myself. Given that it is a simple, short variable, it is likely that other people do too.

Would it be ok to rename all occurrences of a to a or aa or something similar to reduce the chance of interfering with user-defined variables?

Alternative strategy:

__saved_a=$a # at the beginning of the script
a=$__saved_a # restore the value at the end

If either of these sound reasonable, I'd be happy to send a PR.

dhellmann commented 2 months ago

If those are all in functions, we should be using typeset to declare the variable as local to that function. It's definitely a bug in virtualenvwrapper if we are not.