[Gambas-user] pickle?

Benoît Minisini gambas at ...1...
Wed Aug 19 11:30:59 CEST 2009


> O.k. sometimes I'm on the road - and it takes me a while to get back to
> gambas.
>
> Ideally I just want to write a class, which is all strings, to a file and
> read it back in.
>
> I saw in one of the posts that there may be a way to do this, but there
> wasn't any detail... Can any one explain further?
>
>
> FYI   Pickle explained (sortof):
> ----- snip ------
> "Rather than have users be constantly writing and debugging code to
> save complicated data types, Python provides a standard module called
> ‘pickle’.  This is an amazing module that can take almost
> any Python object (even some forms of Python code!), and convert it to
> a string representation; this process is called pickling.
> Reconstructing the object from the string representation is called
> unpickling.  Between pickling and unpickling, the string representing the
> object may have been stored in a file or data, or sent over a network
> connection to some distant machine. "
>
>   ref http://www.network-theory.co.uk/docs/pytut/pickleModule.html
> --------------------
>
> Thanks in advance
>   a gambas newbie :)
>   Peter.
>

That process is usually called "serialization".

There are some serialization routines in the gb.web component. They are used 
to store the session contents inside a file. But they can only handle native 
datatypes, arrays and collections. They cannot handle arbitrary Gambas 
objects.

Regards,

-- 
Benoît




More information about the User mailing list