Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs
[issue1140] re.sub returns str when processing empty unicode string
 

Index | Next | Previous | View Flat


report at bugs

Sep 9, 2007, 11:37 PM


Views: 382
Permalink
[issue1140] re.sub returns str when processing empty unicode string

New submission from Beda Kosata:

While re.sub normally returns unicode strings when processing unicode,
it returns a normal string when dealing with an empty unicode string.

Example:
>>> print type( re.sub( "XX", "", u""))
<type 'str'>
>>> print type( re.sub( "XX", "", u"A"))
<type 'unicode'>

This inconsistency could lead to annoying bugs (at least it did for me :)

----------
components: Regular Expressions
messages: 55775
nosy: beda
severity: minor
status: open
title: re.sub returns str when processing empty unicode string
type: behavior
versions: Python 2.4, Python 2.5

__________________________________
Tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue1140>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Subject User Time
[issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 9, 2007, 11:37 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 9, 2007, 11:37 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 10:14 AM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 11:25 AM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 11:42 AM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 1:37 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 2:40 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 2:40 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 2:54 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 2:56 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 3:01 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 3:03 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 10, 2007, 3:04 PM
    [issue1140] re.sub returns str when processing empty unicode string report at bugs Sep 17, 2007, 2:44 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.