Marshal Obj is String or Binary?

Max rabkin at mweb[DOT]co[DOT]za
Sat Jan 14 05:36:59 EST 2006


Giovanni Bajo wrote:
>>
>>What you see isn't always what you have. Your database is capable of
>>storing \ x 0 0 characters, but your string contains a single byte of
>>value zero. When Python displays the string representation to you, it
>>escapes the values so they can be displayed.
> 
> 
> He can still store the repr of the string into the database, and then
> reconstruct it with eval:
> 

Yes, but len(repr('\x00')) is 4, while len('\x00') is 1. So if he uses
BLOB his data will take almost a quarter of the space, compared to your
method (stored as TEXT).

--Max



More information about the Python-list mailing list