Peter Williams <pwil3...@bigpond.net.au> added the comment:

The class I was pickling was a top level class but a field inside that class 
had an instance of a nested class set as its value.  The error message produced 
indicated that the reason for failure was the inability of pickle to find the 
class definition and (I think) that was caused by the problem with type()'s 
returned value.

Perhaps fixing the problem with type() would allow the restriction on pickling 
nested classes to be removed?  Was that restriction a deliberate design 
decision (illogical) or the result of not being able to get it to work?

Re whether the behaviour of type() is a problem:  I believe it is as, in 
addition to the inconsistencies between type() and isinstance() that I 
described in my original report, there is the confusion that arises if two 
separate classes have nested classes with the same name (see mini program 
confusion.py as an example).  This seems to compromise the whole purpose of 
namespaces and is inconsistent with the way modules are treated in determining 
the name reported by type().

----------
type: behavior -> crash
Added file: http://bugs.python.org/file22544/confusion.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12457>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to