On 15/04/2013 22:13, Dave Angel wrote:
On 04/15/2013 01:43 PM, Antoon Pardon wrote:
[...]
I had gotten my hopes up after reading this but then I tried:
$ python3
Python 3.2.3 (default, Feb 20 2013, 17:02:41)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class vslice (slice):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type 'slice' is not an acceptable base type
It seems types and classes are still not mere synonyms.
No, it seems you're trying to use an internal detail as though it were a
supported feature.
From page:
http://docs.python.org/3.3/reference/datamodel.html#types
"""Internal types
A few types used internally by the interpreter are exposed to the user.
Their definitions may change with future versions of the interpreter,
but they are mentioned here for completeness.
"""
To be fair, one can't do this either:
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64
bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> class C(type(lambda: None)):
pass
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
class C(type(lambda: None)):
TypeError: type 'function' is not an acceptable base type
and I don't think that FunctionType would be considered an "internal
detail", would it? Not that I'd cite the fact that not all types can be
inherited from as evidence that types and classes are not synonyms, mind.
--
http://mail.python.org/mailman/listinfo/python-list