Why does this not work?

Bart Van Loon bbbart at inGen.be
Fri Feb 2 07:57:40 EST 2007


It was 2 Feb 2007 04:41:48 -0800, when alain wrote:
> I tried the following:
>
> myobj=object()
> myobj.newattr=5
>
> results in:
>
>
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> AttributeError: 'object' object has no attribute 'newattr'
>
> Any idea?

I think it's because... object has no attribute 'newattr'

what else is there left to say?

try:

myobj=object()
print dir(myobj)

does that contain 'myattr'?

-- 
groetjes,
BBBart

   "To make a bad day worse, spend it wishing for the impossible." -Calvin



More information about the Python-list mailing list