Re: Yet Another Switch-Case Syntax Proposal

2014-04-10 Thread Lucas Malor
On 6 April 2014 20:07, Chris Angelico rosuav-at-gmail.com |python-list@python.org| wrote: > Here's a simpler form of the proposal, which might cover what you > need. It's basically a short-hand if/elif tree. > > case expression comp_op expression: > suite > case [comp_op] expression: > su

Re: Yet Another Switch-Case Syntax Proposal

2014-04-03 Thread Lucas Malor
Thank you for reading and commenting my proposal. Here are my replies: In reply to Chris Angelico: > I don't like the "iterable vs non-iterable" distinction. Compare: [...] > case "Test": # And there's your problem. Yes, I had already thought after I posted that testing against string it's a pr

Yet Another Switch-Case Syntax Proposal

2014-04-02 Thread Lucas Malor
Hi all. I would proposeto you all a switch-case syntax for Python. I already read PEP 3103 and I'm not completely satisfied by any of the proposed solutions. This is my proposal: switch_stmt ::= "switch" identifier "case" expression_list ":" suite ("case" expression_list ":" suite)* ["e

Re: Problem with getting an option value

2007-04-10 Thread Lucas Malor
Peter Otten wrote: > Lucas Malor wrote: >> >> The problem is options is an instance, so options."delete", for example, >> is wrong; I should pass options.delete . How can I do? > > Use getattr(): Thank you. Do you know also if I can do a similar operation wit

[optparse] Problem with getting an option value

2007-04-06 Thread Lucas Malor
Hello all. I'm trying to do a little script. Simply I want to make a list of all options with them default values. If the option is not specified in the command line, the script must try to read it in a config.ini file. If it's not present also there, it must set the default value. The problem