Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Terry Reedy
On 1/30/2014 6:00 PM, CM wrote: On Thursday, January 30, 2014 5:25:31 PM UTC-5, Chris Angelico wrote: On Fri, Jan 31, 2014 at 9:04 AM, CM wrote: fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = not all(i == '[omitted]' for i in fake_data) Trying to get

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 4:05 PM, Terry Reedy wrote: > On 1/30/2014 5:55 PM, Chris Angelico wrote: >> >> On Fri, Jan 31, 2014 at 9:48 AM, CM wrote: >>> >>> builtin_all = __builtins__.all >>> >>> but I got the error: >>> >>> AttributeError: 'dict' object has no attribute 'all' >> >> >> Try using sq

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Terry Reedy
On 1/30/2014 5:55 PM, Chris Angelico wrote: On Fri, Jan 31, 2014 at 9:48 AM, CM wrote: builtin_all = __builtins__.all but I got the error: AttributeError: 'dict' object has no attribute 'all' Try using square brackets notation instead. Apparently your __builtins__ is a dictionary, not a mod

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 10:00 AM, CM wrote: > Essentially, if ALL the items in that list are '[omitted]', I must not > process the list, but if even one of them is something other than > '[omitted]', I need to process it. Okay. The set example that I gave will work, then - as long as all items

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Peter Otten
CM wrote: > On Thursday, January 30, 2014 5:14:57 PM UTC-5, Peter Otten wrote: > >> Hint: >> >> >>> def demo(): >> ... fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] >> ... fake_result = not all(i == '[omitted]' for i in fake_data) >> ... print 'This is fake result: ', f

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
On Thursday, January 30, 2014 5:25:31 PM UTC-5, Chris Angelico wrote: > On Fri, Jan 31, 2014 at 9:04 AM, CM wrote: > > > fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] > > > fake_result = not all(i == '[omitted]' for i in fake_data) > > > print 'This is fake result: ',

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
> Try using square brackets notation instead. Apparently your > __builtins__ is a dictionary, not a module, though I don't know why > (probably something to do with numpy, which I've never actually used). > > But try this: > builtin_all = __builtins__["all"] > > It might work. Yes, it does. Tha

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 9:48 AM, CM wrote: > builtin_all = __builtins__.all > > but I got the error: > > AttributeError: 'dict' object has no attribute 'all' Try using square brackets notation instead. Apparently your __builtins__ is a dictionary, not a module, though I don't know why (probably s

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
On Thursday, January 30, 2014 5:14:57 PM UTC-5, Peter Otten wrote: > Hint: > > >>> def demo(): > ... fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] > ... fake_result = not all(i == '[omitted]' for i in fake_data) > ... print 'This is fake result: ', fake_result > > >>> d

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 9:04 AM, CM wrote: > fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] > fake_result = not all(i == '[omitted]' for i in fake_data) > print 'This is fake result: ', fake_result Trying to get my head around this. You want to see if all the values in fa

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Peter Otten
CM wrote: > This is puzzling. (Using Python 2.5, WinXP, Boa Constructor 0.6.1 > definitely running the code through Python 2.5) > > If I run these lines in my program, through my IDE (Boa Constructor), > > fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] > fake_result = not a

Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
This is puzzling. (Using Python 2.5, WinXP, Boa Constructor 0.6.1 definitely running the code through Python 2.5) If I run these lines in my program, through my IDE (Boa Constructor), fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = not all(i == '[omitted]' for