Antoine Pitrou <[EMAIL PROTECTED]> added the comment:
With immutable types, you must use __new__ instead. Passing the
arguments to __init__ is too late since the object is immutable and it
has already been built in memory, thus you can't initialize it with
another value.
>>> class B(bytes):
...
New submission from STINNER Victor <[EMAIL PROTECTED]>:
Example:
class MyBytes(bytes):
def __init__(self, *args, **kw):
bytes.__init__(self, *args, **kw)
a = bytes(b"hello") # ok
b = MyBytes(b"hello") # error
=> DeprecationWarning: object.__init__() takes no parameters