I've been making heavy use of the answer in "Really Cheap Command-Line Option Parsing in Ruby". It's great and for my purposes, always what I need.
Now I find myself back in Python land for a bit because of internal library support for something I want to do. I'm considering porting it to Ruby but that's beyond the scope of this question, but I'd like to use something similar.
Here is the really cheap method I use often in Ruby:
$quiet = ARGV.delete('-d')
$interactive = ARGV.delete('-i')
If there is a "-d"
in the ARGV
array, then $quiet
is set to "-d"
and not nil. If there is no "-d"
, then $quiet
becomes nil
.
Is there something similar I could do in Python?