[DB-SIG] PEP 249 .Binary() function incorrect for Python 3.0 ?

Vernon Cole vernondcole at gmail.com
Mon Feb 2 23:59:53 CET 2009


Marc-Andre;
  So, to clarify:  You are saying that it is acceptable for a Python 3.0
implementation
to raise an error when .Binary() receives a unicode string.  It should
expect a b'xxx binary string here xxx' type.
  Is that correct?
--
Vernon

On Mon, Feb 2, 2009 at 10:01 AM, M.-A. Lemburg <mal at egenix.com> wrote:

> On 2009-02-02 17:34, Vernon Cole wrote:
> > Hello, everyone:
> >
> > Work has gone well in porting adodbapi to work in Python 3.0. The result
> > should be posted in a beta version in pywin32 v.213 real soon now.
> > I have patched the standards compliance test as discussed earlier in this
> > forum.
> > There is one last error I am getting, but I believe that should be left
> > intact, as a protection when porting to 3.0.
> >
> > The PEP says:
> >> Binary(string)
> >>
> >> This function constructs an object capable of holding a
> >> binary (long) string value.
> >
> > Given that Python 3.0 no longer uses a string for this purpose, the
> routine
> > should really accept an object of data type "byte".
>
> That's not entirely correct: the return type of Binary() is not defined
> by the spec, only the fact that a binary string must be acceptable as
> input type. In Python 2, this is str(), in Python 3, bytes().
>
> The output type of Binary() is module specific, since different modules
> may need different types.
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, Feb 02 2009)
> >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
> >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
>
> ::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
>
>
>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>           Registered at Amtsgericht Duesseldorf: HRB 46611
>               http://www.egenix.com/company/contact/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20090202/dccf6a67/attachment.htm>


More information about the DB-SIG mailing list