A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-May/024816.html below:

[Python-Dev] Removing types module from stdlib

[Python-Dev] Removing types module from stdlib [Python-Dev] Removing types module from stdlibKevin Jacobs jacobs@penguin.theopalgroup.com
Fri, 31 May 2002 15:34:27 -0400 (EDT)
On Fri, 31 May 2002, Guido van Rossum wrote:
> str and unicode have special status and it shouldn't be easy to create
> something else (not deriving from either) that also gets this special
> status.  (You can still do it in C of course.)

I use this little toy on occasion:

class istr(str):
  __slots__ = ()
  def __hash__(self):
    return hash(self.lower())
  def __eq__(self, other):
    return self.lower() == other.lower()
  def __ne__(self, other):
    return self.lower() != other.lower()
  def __le__(self, other):
    return self.lower() <= other.lower()
  def __ge__(self, other):
    return self.lower() >= other.lower()
  def __lt__(self, other):
    return self.lower() < other.lower()
  def __gt__(self, other):
    return self.lower() > other.lower()

Are you saying that you want to outlaw it?

-Kevin

--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4