attribute is accessed from Nonetype

Dave Angel d at davea.name
Thu Aug 2 07:04:15 EDT 2012


On 08/02/2012 06:28 AM, Shanth Kumar wrote:
> Hi ,All,
> I am Shanthkumar. Good to see the mailing list for python programmers.

Welcome to the list.

> Please find my query below,
>
> In my source code in a python file e.g xyz.py couple of classes are defined
> also there is a wrapper class, a none object is declared in the file e.g
> temp=None
> from temp some attributes are being accessed in the files that are
> importing xyz.py
> even though temp is not initialised to any other object still it is none
> object attributes are being accessed from None object.Is there any
> significance of wrapper class here..?
> Can you please help me.
>
>
Once you actually supply some code.  Build a small example illustrating
your problem, and explain better what is wrong/unexpected with how it
works.  If an import of xyz.py is necessary, then show both files.

Are you surprised that the None object has attributes?  It has at least
15 in Python 2.7.   Or are you surprised that temp is different in other
modules than it is in xyz.py ?  Or are you surprised that wrapping a
NoneType is possible?

Also, please use the names correctly and consistently.  The None object
(yes, there is only one) is not the same as a none object.  And there is
no standard type called Nonetype.

Finally, please avoid runon sentences.  By the time we parse where the
periods are supposed to be, we just may lose the meaning you had in mind.



-- 

DaveA




More information about the Python-list mailing list