[ANN] optphart (alpha2)

R

rantingrick

"""
I am pleased to announce optphart (alpha2)!

-------------------
What is optphart?
-------------------
optphart is the nemisis of the asinine interfaces and bulky libraries
you may be accustomed to in the stdlib. All of which clog your scripts
with wasted lines and your memory with complex interfaces far worse
than any colon clogging putrifaction of junk food can hold a candle
to. Do yourself a favor and give your scripts an enema by harnessing
the simplistic elegance of the "optphart" module instead!

----------------------------
Whats new in this release:
----------------------------
- This release is less likely to blow chunks than the last.
- Now you can pass single opts! Woo Hoo!
"""

def optphart(args):
d = {'args':[], 'opts':[]}
for arg in args:
if arg.startswith('-'):
try:
key, value = arg.split('=', 1)
except ValueError:
d['opts'].append(arg[1:])
options = value.split(',')
if len(options) > 1:
d[key[1:]] = filter(None, options)
else:
d[key[1:]] = value
else:
d['args'].append(arg)
return d


if __name__ == '__main__':
args = [
'nakedArgumentOne',
'nakedArgumentTwo',
'-key1=value1',
'-key2=value2,', #trailing comma converts to array
'-file=C:\\temp.txt',
'-options1=Op1,Op2,Op3,Op4',
'-options2=Op1,Op2,Op3,Op4,',
'-help',
'-regex',
]
opts = optphart(args)
#print opts.keys()
for k,v in opts.items():
print '%s -> %s' %(k, v)
 
S

Stephen Hansen

"""
I am pleased to announce optphart (alpha2)!

This is just stupid.

It isn't worthy of any more elaborate response.

You just don't get the point, do you?

--

... Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/
 
R

rantingrick

This is just stupid.
It isn't worthy of any more elaborate response.

Well gee thanks Stephen. Why don't you just kick me in the balls while
your at it? *Maybe* you don't find it useful. *Maybe* no one will find
it useful. However, i did manage to move D'Aprano's cesarcipher module
up one peg from index zero on the community totem pole, so i *would*
say it has at least *some* usage to him!
You just don't get the point, do you?

And just what *point* an i supposed to be "getting" Stephen? That you
don't like my contribution? If thats your point then i very much "get"
it.
 
S

Stephen Hansen

And just what *point* an i supposed to be "getting" Stephen? That you
don't like my contribution? If thats your point then i very much "get"
it.

This garbage:

"optphart is the nemisis of the asinine interfaces and bulky libraries
you may be accustomed to in the stdlib. All of which clog your scripts
with wasted lines and your memory with complex interfaces far worse
than any colon clogging putrifaction of junk food can hold a candle
to. Do yourself a favor and give your scripts an enema by harnessing
the simplistic elegance of the "optphart" module instead!"

It doesn't advocate your solution; it doesn't describe the benefits of
using it; it doesn't provide a reasonable or technical basis by which it
is in some way superior to others.

It just hand waves other solutions (which exist and are more fully
featured for *very* good reasons-- but you don't bother addressing why
less is more here, you basically just declare it all shit) all the while
being simply insulting to the authors and users of those solutions.

--

... Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/
 
J

Jean-Michel Pichavant

Stephen said:
This garbage:

"optphart is the nemisis of the asinine interfaces and bulky libraries
you may be accustomed to in the stdlib. All of which clog your scripts
with wasted lines and your memory with complex interfaces far worse
than any colon clogging putrifaction of junk food can hold a candle
to. Do yourself a favor and give your scripts an enema by harnessing
the simplistic elegance of the "optphart" module instead!"

It doesn't advocate your solution; it doesn't describe the benefits of
using it; it doesn't provide a reasonable or technical basis by which
it is in some way superior to others.

It just hand waves other solutions (which exist and are more fully
featured for *very* good reasons-- but you don't bother addressing why
less is more here, you basically just declare it all shit) all the
while being simply insulting to the authors and users of those solutions.

Come on guys :) relax.

"elegance of the optphart module", can't you see it's nothing else but a
joke ;)

JM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,933
Members
47,472
Latest member
blackwatermelon

Latest Threads

Top