Re: Hard to understand 'eval'

2008-06-16 Thread Bruno Desthuilliers
TheSaint a écrit : On 01:15, lunedì 16 giugno 2008 Calvin Spealman wrote: such as getattr(obj, methname)(a, b, c). Does this make sense? This is big enlightenment :) Thank you! :) I found problem with eval() when it comes to pass quoted strings. I circumvent that by encapsulating the strings

Re: Hard to understand 'eval'

2008-06-16 Thread Bruno Desthuilliers
TheSaint a écrit : On 04:08, domenica 15 giugno 2008 [EMAIL PROTECTED] wrote: what's wrong with getattr(cp, nn) ? The learning curve to get into these programming ways. Does gettattr run the snippet passed in? Nope, it just does what the name implies. Considering that nn is a name of func

Re: Hard to understand 'eval'

2008-06-15 Thread Gabriel Genellina
En Sat, 14 Jun 2008 05:31:35 -0300, TheSaint <[EMAIL PROTECTED]> escribió: > It seems to be strange that give me syntax error inside an eval statement. > I'm looking at it carefully but I can't see any flaw. > > Here it's part of the code: > > for nn in stn_items: > value= eval('cp

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 05:05, 16-6- 2008 Dennis Lee Bieber wrote: >> # any number of digit followed by 0 or 1 (k or m), case insensitive > > I don't do regular expressions... and the comment doesn't help > "digit followed by 0 or 1", when 0/1 ARE digits themselves... That means either none or one letter, of whi

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 01:15, lunedì 16 giugno 2008 Calvin Spealman wrote: > such as getattr(obj, > methname)(a, b, c). Does this make sense? This is big enlightenment :) Thank you! :) I found problem with eval() when it comes to pass quoted strings. I circumvent that by encapsulating the strings in variable or tup

Re: Hard to understand 'eval'

2008-06-15 Thread John Machin
On Jun 16, 7:05 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 15 Jun 2008 17:45:12 +0800, TheSaint <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > is it an ifelifelif probing only the first matching case and drop > > the > > remaining checks? > >

Re: Hard to understand 'eval'

2008-06-15 Thread Calvin Spealman
The point here is that eval() use is general frowned upon. If you don't understand it or the alternatives, then you probably don't understand it well enough to make the call on using it or not. If you need just look up an attribute where the name of the attribute is in a variable, use getat

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 06:34, domenica 15 giugno 2008 Dennis Lee Bieber wrote: >> for nn in stn_items: > I already see a syntax error when viewing that in Agent... A missing > indent level under the "for" The program don't complain wrong indentation, I mostly sure a wrong copy-paste error. Error doesn't com

Re: Hard to understand 'eval'

2008-06-15 Thread TheSaint
On 04:08, domenica 15 giugno 2008 [EMAIL PROTECTED] wrote: > what's wrong with getattr(cp, nn) ? The learning curve to get into these programming ways. Does gettattr run the snippet passed in? Considering that nn is a name of function, which will be called and (cfl, value) are the parameters to p

Re: Hard to understand 'eval'

2008-06-14 Thread [EMAIL PROTECTED]
On 14 juin, 10:31, TheSaint <[EMAIL PROTECTED]> wrote: > Hi, > > It seems to be strange that give me syntax error inside an eval statement. > I'm looking at it carefully but I can't see any flaw. > > Here it's part of the code: > > for nn in stn_items: > value= eval('cp.%s' %nn) He

Hard to understand 'eval'

2008-06-14 Thread TheSaint
Hi, It seems to be strange that give me syntax error inside an eval statement. I'm looking at it carefully but I can't see any flaw. Here it's part of the code: for nn in stn_items: value= eval('cp.%s' %nn) if value and (nn in 'log, trash, multithread, verbose, download')