I noticed that UserString objects have methods that do not accept other
UserString objects as arguments:


>>> from UserString import UserString
>>> UserString('slartibartfast').count(UserString('a'))

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in -toplevel-
    UserString('slartibartfast').count(UserString('a'))
  File "C:\PY24\lib\UserString.py", line 66, in count
    return self.data.count(sub, start, end)
TypeError: expected a character buffer object

>>> UserString('abc') in UserString('abcde')

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in -toplevel-
    UserString('abc') in UserString('abcde')
  File "C:\PY24\lib\UserString.py", line 35, in __contains__
    return char in self.data
TypeError: 'in <string>' requires string as left operand


This sort of thing is easy to test for and easy to fix.  The question is
whether we care about updating this module anymore or is it a relic.
Also, is the use case one that we care about.  AFAICT, this has never
come up before.


Raymond

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to