mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Don't need to implement __new__ to make an immutable class
This commit is contained in:
parent
a858987844
commit
b1953640d2
|
@ -55,8 +55,7 @@ class Range(object):
|
|||
"""
|
||||
__slots__ = ('_lower', '_upper', '_bounds')
|
||||
|
||||
def __new__(cls, lower=None, upper=None, bounds='[)', empty=False):
|
||||
self = super(Range, cls).__new__(cls)
|
||||
def __init__(self, lower=None, upper=None, bounds='[)', empty=False):
|
||||
if not empty:
|
||||
if bounds not in ('[)', '(]', '()', '[]'):
|
||||
raise ValueError("bound flags not valid: %r" % bounds)
|
||||
|
@ -67,8 +66,6 @@ class Range(object):
|
|||
else:
|
||||
self._lower = self._upper = self._bounds = None
|
||||
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
if self._bounds is None:
|
||||
return "%s(empty=True)" % self.__class__.__name__
|
||||
|
|
Loading…
Reference in New Issue
Block a user