RE: re.search when used within an if/else fails

2012-11-29 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > > Unless there has been a major change in the parser... (I still don't > have Python 3.x installed) > > I believe is expanded to 8-spaces -- NOT TO NEXT MULTIPLE OF > 8... A tab is *one* character. Your *editor* may show tabs visually "expanded" or conver

RE: re.search when used within an if/else fails

2012-11-29 Thread Prasad, Ramit
Ramit Prasad wrote: > > Dennis Lee Bieber wrote: > > > > Unless there has been a major change in the parser... (I still don't > > have Python 3.x installed) > > > > I believe is expanded to 8-spaces -- NOT TO NEXT MULTIPLE OF > > 8... > > A tab is *one* character. Your *editor* may show

Re: re.search when used within an if/else fails

2012-11-29 Thread Duncan Booth
Dennis Lee Bieber wrote: > Unless there has been a major change in the parser... (I still don't > have Python 3.x installed) > > I believe is expanded to 8-spaces -- NOT TO NEXT MULTIPLE OF > 8... > Certainly in Python 2.7 that's not the case: the tab expands to the next multiple o

Re: re.search when used within an if/else fails

2012-11-28 Thread Ian Kelly
On Wed, Nov 28, 2012 at 5:20 PM, Dennis Lee Bieber wrote: > On 28 Nov 2012 21:39:03 GMT, Steven D'Aprano > declaimed the following in > gmane.comp.python.general:> py> if True: > > ... if True: # tab > > ... pass # tab, then four spaces > > ... pass # two spaces, tab, four s

Tabs/spaces for indentation (was Re: re.search when used within an if/else fails)

2012-11-28 Thread Chris Angelico
On Thu, Nov 29, 2012 at 8:39 AM, Steven D'Aprano wrote: > Perhaps it would be nice if Python honoured a directive setting indent > style to spaces or indents, as it honours source code encoding lines: > > # -*- indent: -*- > > Where could be one of: > > space[s]Only accept spaces in inde

Re: re.search when used within an if/else fails

2012-11-28 Thread Steven D'Aprano
On Wed, 28 Nov 2012 14:08:15 -0600, Evan Driscoll wrote: > I'm only entering this thread now so I'm not really in context, but > you're correct; in Python 3, -tt is set by default, which makes illegal > mixing an error. > > However, not all mixing is illegal: what it means by "code that > illegal

Re: re.search when used within an if/else fails

2012-11-28 Thread Steven D'Aprano
On Wed, 28 Nov 2012 11:39:48 -0800, Kevin T wrote: > with other languages i always expand tabs to spaces. the vi plugin does > do this properly. if i change all indents to be spaces only will python > behave? i inherited a good deal of the code that i am using, which is > tab based. Python wil

Re: Re: re.search when used within an if/else fails

2012-11-28 Thread Evan Driscoll
On 11/28/2012 01:57 PM, Ian Kelly wrote: > Yes, it's best to use either tabs-only or spaces-only. Quoting from PEP > 8 on the subject: > > Never mix tabs and spaces. > > The most popular way of indenting Python is with spaces only. The > second-most popular way is with tabs only. Cod

Re: re.search when used within an if/else fails

2012-11-28 Thread Ian Kelly
On Wed, Nov 28, 2012 at 12:39 PM, Kevin T wrote: > with other languages i always expand tabs to spaces. the vi plugin does do this properly. if i change all indents to be spaces only will python behave? i inherited a good deal of the code that i am using, which is tab based. Yes, it's best to

Re: re.search when used within an if/else fails

2012-11-28 Thread Kevin T
I agree. Being relatively new to python, i was not sure of quirks so i posted the original code. I did find the real issue, as I found another loop that was not being executed properly. It turns out that if the indent started with spaces and ended with tabs, neither eclipse or command line e

Re: re.search when used within an if/else fails

2012-11-21 Thread Chris Angelico
On Thu, Nov 22, 2012 at 3:41 AM, Kevin T wrote: > I went back and tried version a again, blam it is/does work now ?!?!? > I am not sure what changed but version a was the original code that > wouldn't work. All the examples i had read, showed version a as a > working version. I spent significant

Re: re.search when used within an if/else fails

2012-11-21 Thread Kevin T
On Nov 20, 1:37 pm, Ian Kelly wrote: > On Tue, Nov 20, 2012 at 12:09 PM, Kevin T wrote: > > #if re.search( "rsrvd", sigName ) :   #version a > > #if re.search( "rsrvd", sigName ) == None :   #version b > > if re.search( "rsrvd", sigName ) is None :   #version bb > >    print sigName > >    newVal

Re: re.search when used within an if/else fails

2012-11-20 Thread Ian Kelly
On Tue, Nov 20, 2012 at 12:37 PM, Ian Kelly wrote: > On Tue, Nov 20, 2012 at 12:09 PM, Kevin T wrote: >> #if re.search( "rsrvd", sigName ) : #version a >> #if re.search( "rsrvd", sigName ) == None : #version b >> if re.search( "rsrvd", sigName ) is None : #version bb >>print sigName >>

Re: re.search when used within an if/else fails

2012-11-20 Thread Ian Kelly
On Tue, Nov 20, 2012 at 12:09 PM, Kevin T wrote: > #if re.search( "rsrvd", sigName ) : #version a > #if re.search( "rsrvd", sigName ) == None : #version b > if re.search( "rsrvd", sigName ) is None : #version bb >print sigName >newVal = "%s%s" % ('1'*signal['bits'] , newVal ) > #else

Re: re.search when used within an if/else fails

2012-11-20 Thread Kevin T
On Monday, November 19, 2012 7:29:20 PM UTC-6, Steven D'Aprano wrote: > On Tue, 20 Nov 2012 01:24:54 +, Steven D'Aprano wrote: > > > > - use "if something is None", not == None. > > > Steven i will not include line #'s in the future, point taken i will change ==/!= to is/is not as most pe

Re: re.search when used within an if/else fails

2012-11-19 Thread Steven D'Aprano
On Mon, 19 Nov 2012 15:43:10 -0800, Kevin T wrote: > python version 2.4.3, yes i know that it is old. getting the sysadmin > to update the OS requires a first born. > > with the following code.. > for signal in register['signals'] : > > 351 sigName = signal['fu

Re: re.search when used within an if/else fails

2012-11-19 Thread Steven D'Aprano
On Tue, 20 Nov 2012 01:24:54 +, Steven D'Aprano wrote: > Your code is mangled to the point of unreadability. Ah, never mind, that's *my* fault, not yours. Or rather, my news reader software. Sorry about the noise. The rest of my post still stands: - simplify your example to the simplest e

Re: re.search when used within an if/else fails

2012-11-19 Thread MRAB
On 2012-11-19 23:43, Kevin T wrote: python version 2.4.3, yes i know that it is old. getting the sysadmin to update the OS requires a first born. with the following code.. for signal in register['signals'] : 351 sigName = signal['functionName'] 352