[Python-Dev] RE: [Python-checkins] python/dist/src/Misc NEWS, 1.983, 1.984
Fix grammar hopefully. :) [...] ! - Unicode type got two new methods; iswide() and width(). They ! manipulate east asian width information as of Unicode TR11. [...] ! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11.
Not that I think that having grammatically perfect NEWS is at all important, but this isn't grammatically correct. Something like "The Unicode type received two new methods: iswide() and width(). These manipulate East Asian width information, as outlined in Unicode TR11" is probably what you're after. =Tony Meyer
Tony Meyer wrote:
[...]
! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11.
Should these methods be added to UserString too? Bye, Walter Dörwald
On Thu, Jun 03, 2004 at 12:26:43PM +0200, Walter D?rwald wrote:
Tony Meyer wrote:
[...]
! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11.
Should these methods be added to UserString too?
iswide() and width() are for unicode objects only. Please see Martin's reply on addition of the methods to string objects: http://mail.python.org/pipermail/python-dev/2004-June/045153.html Hye-Shik
Hye-Shik Chang wrote:
On Thu, Jun 03, 2004 at 12:26:43PM +0200, Walter D?rwald wrote:
Tony Meyer wrote:
[...]
! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11.
Should these methods be added to UserString too?
iswide() and width() are for unicode objects only. Please see Martin's reply on addition of the methods to string objects: http://mail.python.org/pipermail/python-dev/2004-June/045153.html
Yes, but UserString.UserString can be used to wrap both str and unicode objects. Bye, Walter Dörwald
On Thu, Jun 03, 2004 at 03:18:47PM +0200, Walter D?rwald wrote:
Hye-Shik Chang wrote:
On Thu, Jun 03, 2004 at 12:26:43PM +0200, Walter D?rwald wrote:
Tony Meyer wrote:
[...]
! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11.
Should these methods be added to UserString too?
iswide() and width() are for unicode objects only. Please see Martin's reply on addition of the methods to string objects: http://mail.python.org/pipermail/python-dev/2004-June/045153.html
Yes, but UserString.UserString can be used to wrap both str and unicode objects.
Aah. Sorry. I've overlooked extensive use of UserString. :) Could you review my patch?: http://people.freebsd.org/~perky/userstring-width.diff Hye-Shik
Hye-Shik Chang wrote:
On Thu, Jun 03, 2004 at 03:18:47PM +0200, Walter D?rwald wrote:
[...] Yes, but UserString.UserString can be used to wrap both str and unicode objects.
Aah. Sorry. I've overlooked extensive use of UserString. :)
Could you review my patch?: http://people.freebsd.org/~perky/userstring-width.diff
I don't think it's necessary to define iswide() and width() only when self.data is a unicode object (in fact, self.data might change from str to unicode during the lifetime of the UserString object). Simply define # the following methods are defined for unicode objects only: def iswide(self): return self.data.iswide() def width(self): return self.data.width() When a str object is wrapped, an AttributeError will be raised anyway, it shouldn't be a problem that this error is not raised by UserString itself. You could add comments to the method like this: def iswide(self): return self.data.iswide() # unicode only def width(self): return self.data.width() # unicode only that will show up in a stacktrace and give a hint to the user. It's good that the tests are in string_tests.py now, but you should reuse this test class in test_unicode.py too. Bye, Walter Dörwald
participants (3)
-
Hye-Shik Chang
-
Tony Meyer
-
Walter Dörwald