[Zope-dev] Blobs and modes

Benji York benji at zope.com
Fri Oct 24 15:50:33 EDT 2008


On Fri, Oct 24, 2008 at 3:28 PM, Jim Fulton <jim at zope.com> wrote:
>
> On Oct 24, 2008, at 3:24 PM, Benji York wrote:
>
>> Is there a good reason blobs don't support "b" or "t" in the mode
>> strings passed to "open"?  I'm refactoring some code that expects a
>> file-like object to use blobs and it wants to pass "wb" as the mode
>> (which is a sane thing to do).
>
> Blobs are implicitly binary. (Note the "B" in Blob.)
>
>> I'll add support for "b" and "t" to the blob code if no one objects.
>
> I object.
>
> BTW, this questions should have been asked o zodb-dev.

[yep, copied on this message]

For perpetuity:

In a private discussion Jim explained that the blob .open() method
returns things intended to be file-like, but the method itself isn't
intended to mimic Python's "open" function, and as-such doesn't support
the additional mode variations.

This distinction is similar to why __init__ methods aren't described in
(zope.interface) interfaces; how you construct an object isn't
prescribed by the interface exposed by the object itself.
-- 
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope-Dev mailing list