On 10/22/05, Jacob S. <[EMAIL PROTECTED]> wrote:
> >> def nameCheck(self, value):
> >> > import re
> >> > tempREG = re.match('.*:.*',value)
> >> > return str(tempREG) != 'None'
>
> This could be written better.
>
> def nameCheck(self, value):
> tempREG = re.match('.*:.
>> def nameCheck(self, value):
>> > import re
>> > tempREG = re.match('.*:.*',value)
>> > return str(tempREG) != 'None'
>>
>> Still a syntax error here!
>>
> Code is working as I thought it would. What syntax error do I have?
This could be written better.
def nameCheck(s
DUH.. I found the answer
mytest = [name for name in test]
Thanks again..
> > The above four lines could be replaced with a single list comprehension
> > if you like: baseObjectList = [ TPROJ(name) for name in baseList if
> > nameCheck(name) ]
> > http://www.amk.ca/python/2.0/index.html#SEC
> The above four lines could be replaced with a single list comprehension if
> you like: baseObjectList = [ TPROJ(name) for name in baseList if
> nameCheck(name) ]
> http://www.amk.ca/python/2.0/index.html#SECTION00060
>
> Kent
>
BOOOM
Let me pick up my skull fr
Eric Walker wrote:
> On Thursday 06 October 2005 12:48 pm, Kent Johnson wrote
> yes, I did remove this from the class. I really didn't need it in there. I
> moved the check outside under the main running function. To check the name
> before I even create the object. The way I had it before it wo
On Thursday 06 October 2005 12:48 pm, Kent Johnson wrote
> > class TPROJ:
> > import re
> > import string
>
> Common usage is to put all the imports at the top of the module. There are
> circumstances where you will put them inside a function but not in this
> case.
I moved them all to the
Eric Walker wrote:
> Sorry Kent,
> In my haste to just simulate I did make the example with syntax errors. Let
> me
> try this again and I guess your teaching me how to use this mailing list the
> correct way also.
Yes.
> Ok this is the actual code. I am able to get it to run
> from the co
Hi Eric,
Quick comment on the last part of your program:
> try:
> getProjectNames()
> except:
> print "Got an Error"
Don't do that. *grin*
This is considered a misuse of exceptions. As a concrete example, say
that we have a buggy program like this:
##
>>> def showDivisions(n):
Sorry Kent,
In my haste to just simulate I did make the example with syntax errors. Let me
try this again and I guess your teaching me how to use this mailing list the
correct way also. Ok this is the actual code. I am able to get it to run
from the command line.
Thanks kent for your patience
Eric Walker wrote:
> Kent,
> Where I think my problem maybe in how I am running this. I want to eventually
> run from the command line. I started python idle from my linux command line
> and I was cut and pasting from my text file and seeing things work. Now i
> want to run it from the command l
Its working now. the moving of the function outside of the class allows me to
run it from the command line.
Thanks
On Thursday 06 October 2005 11:56 am, Eric Walker wrote:
> Kent,
> I made a correction the func1 I moved out of the class definition since it
> wasn't really a method. so it should
Kent,
Where I think my problem maybe in how I am running this. I want to eventually
run from the command line. I started python idle from my linux command line
and I was cut and pasting from my text file and seeing things work. Now i
want to run it from the command line and its complaining. in m
Eric Walker wrote:
> I have a class I am defining and then I call a function within that class.
> Getting error that function call is not defined. Does the function have to be
> created anywhere within a class or does it have to be defined before the call
> within the class.
Actual code and the
I have a class I am defining and then I call a function within that class.
Getting error that function call is not defined. Does the function have to be
created anywhere within a class or does it have to be defined before the call
within the class.
--
Eric Walker
EDA/CAD Engineer
Work: 208-36
14 matches
Mail list logo