RE: object instance after if isalpha()

2006-04-12 Thread Marcelo Urbano Lima
ops, I forgot to use the self. so in this example what i was trying to do worked. I'll look further in my original program. sorry to bother you. >From: "Marcelo Urbano Lima" <[EMAIL PROTECTED]> >To: python-list@python.org >Subject: object instance after if isalph

Re: object instance after if isalpha()

2006-04-12 Thread Ben Cartwright
Marcelo Urbano Lima wrote: > class abc: > def __init__(self): > name='marcelo' > print x.name > Traceback (most recent call last): > File "1.py", line 12, in ? > print x.name > AttributeError: abc instance has no attribute 'name' In Python, you explicitly include a reference to an obje

object instance after if isalpha()

2006-04-12 Thread Marcelo Urbano Lima
Hi I'm still learning python and I've been loving it, but, that's not the reason I'm writing. I'm trying to create an object only if a variable is alpha and see what I get. $ cat 1.py class abc: def __init__(self): name='marcelo' a='STRING' print a.isalpha() if a.isalpha(): x=abc() p