mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Slight optimization, finally figured out how to automatically intern all IrcStrings.
This commit is contained in:
parent
41a1c9f4d1
commit
b7fb78abed
@ -389,10 +389,12 @@ def unDccIP(i):
|
||||
|
||||
class IrcString(str):
|
||||
"""This class does case-insensitive comparison and hashing of nicks."""
|
||||
def __new__(cls, s=''):
|
||||
return str.__new__(cls, intern(s))
|
||||
|
||||
def __init__(self, s):
|
||||
assert isinstance(s, basestring), \
|
||||
'Cannot make an IrcString from %s' % type(s)
|
||||
str.__init__(self, intern(s)) # This does nothing, I fear.
|
||||
self.lowered = toLower(s)
|
||||
|
||||
def __eq__(self, s):
|
||||
|
Loading…
Reference in New Issue
Block a user