Trouble using pinckle
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Wed Jul 2 12:11:22 EDT 2008
Pierre-Alain Dorange a écrit :
> Cédric Lucantis <omer at no-log.org> wrote:
>
>> Here self is only a local variable and its meaning is only a convention. So
>> assigning it to a new value won't change the object itself (and is not a good
>> idea as it may be confusing for the reader).
>
> Thanks, i was thinking about something like that.
>
(snip)
> I try the staticmethod, it works fine. Very helpful.
>
> But i don't like it very much, it seems 'complicated' (python was
> supposed to be simple).
Try doing the same thing in C++ !-)
> I'll also try the dictionnary method.
> My final idea was that a dictionnary would be perhaps simple in the
> future to save/load as XML and a parser.
XML ? What a strange idea ?
> But perhaps i'm wrong with my vision of python.
>
> On a more global perspective, what are the best method to implement a
> simple config file with pyhton.
Well... Python does have a couple of config-related packages, starting
with the one in the stdlib. You may want to find out if any of these
packages fits your needs before reinventing the wheel ?
> Assuming i finally want to made a bundle
> app for Mac, Windows and perhaps Linux.
> I develop on Mac, and on this platform the config fil (preferences) have
> to be stored in a special directory : ~/Library/Preferences, no problem.
> But on other platform that's not the same directory and perhaps i would
> also faced to permissions issues...
Yeps. Portability sometimes has a cost. I can't help you wrt/ Windows,
but on unix the convention is to save user's prefs in a .yourprogram
file (or directory) in the user's home directory.
> But first is there a way to determine on which platfrom the python
> script is running ?
the os package is your friend.
More information about the Python-list
mailing list