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

M.-A. Lemburg mal at egenix.com
Mon Feb 2 18:01:21 CET 2009


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/


More information about the DB-SIG mailing list