[Xapian-tickets] [Xapian] #346: Python 3 support

Xapian nobody at xapian.org
Sun Jun 17 12:37:20 BST 2012


#346: Python 3 support
--------------------------------------+-------------------------------------
 Reporter:  olly                      |       Owner:  richard  
     Type:  defect                    |      Status:  assigned 
 Priority:  highest                   |   Milestone:  1.3.2    
Component:  Xapian-bindings (Python)  |     Version:  SVN trunk
 Severity:  normal                    |    Keywords:           
Blockedby:                            |    Platform:  All      
 Blocking:                            |  
--------------------------------------+-------------------------------------

Comment(by james):

 I've been thinking about this again during this discussion, and I'm
 definitely on Olly's side over trying to avoid lots of wrappers. As a
 python user, being unable to pass in Unicode objects (ie str) is just
 unacceptable, and will result in bug reports from everyone who doesn't
 realise they need a wrapper.

 However returning bytes consistently has exactly the same problem and
 using different functions to get the behaviour most people will expect
 seems icky to me; the most sensible solution I've been able to come up
 with is that you could set an encoding at the library level, with None
 meaning use bytes. It's unclean conceptually but means you can achieve
 whatever you need with mostly little fuss; if you need different encodings
 with different databases for instance you'd have to manage everything
 manually anyway because so many things aren't associated with a Database
 object (Query, for instance). Doubly so if you want Document data to be
 UTF 8 but terms to be raw bytes.

 By default I'd favour no encoding, which is the behaviour Olly is
 describing. For the purposes of getting Python 3 support for Ubuntu 12.10
 that seems reasonable and would be forward compatible if (hopefully when)
 we implement output encoding in the python layer ourselves.

 This leaves user implemented functions and the like. For these I'd
 definitely pass byte always, as they are more complex and rare anyway. If
 we documented a way of getting the user-set encoding from the wrapper
 people could write directors that took advantage of that if they wanted to
 make their code reusable.

-- 
Ticket URL: <http://trac.xapian.org/ticket/346#comment:34>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list