[Xapian-tickets] [Xapian] #346: Python 3 support
Xapian
nobody at xapian.org
Fri Sep 20 14:51:11 BST 2013
#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 | Resolution:
Keywords: | Blocked By:
Blocking: | Operating System: All
--------------------------------------+------------------------------
\
\
\
\
\
\
Comment (by james):
I'm +1 on defaulting to using bytes, and +1 talking about "string" methods
(whether `_str`, `_s`; I'm indifferent between them) instead of "unicode",
since this is Py3.
I wonder if `TermGenerator` and `QueryParser` would ideally be namespace-
separated (`xapian.termparsing` or something), since they go together and
are an optional higher-level interface.
I wonder separately if since it doesn't affect stuff stored on disk,
having `query_parser.set_prefix` accept both `bytes` and `str` types and
serialising `str` -> `bytes` using an extra parameter (which defaults to
`'utf8'`) might not be a good solution to that problem. I'm guessing that
most people are going to want to think in terms of strings across the
board; if you're just dealing in unicode data and are happy with UTF-8
(which is probably most Western applications?) then not having to think
about bytes serialisation at all is a lot clearer.
I also wonder still if having an explicit wrapper (`from xapian.utf8
import Document, Database`) bundled as part of our own bindings which uses
`str` everywhere that you'd usually have `bytes` and a `_s` variant, might
stop people writing almost-trivial wrappers. Although honestly if all `_s`
methods and functions take only `str` and return only `str`, with
conversion in and out via `utf8`, then we're probably fine for new
applications, having a `xapian.utf8` wrapper set built-in would be useful
in porting from Py2. (An alternative would be something like `2to3` for
Xapian client code.)
\
\
\
--
Ticket URL: <http://trac.xapian.org/ticket/346#comment:56>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list