[Tutor] Need help printing a pickled data

Marc Tompkins marc.tompkins at gmail.com
Tue Jun 25 01:23:11 CEST 2013


On Mon, Jun 24, 2013 at 3:48 PM, Matt D <md123 at nycap.rr.com> wrote:


> >     def __init__(self, data):
> >         wx.PyEvent.__init__(self)
> >         # this line *binds* this class to a certain type of event,
> > wxDATA_EVENT
> >         self.SetEventType (wxDATA_EVENT)
> >         # and this is the actual data
> >         self.data = data
> >         with open('mypicklelog.txt','a') as log:
> >             log.write(self.data)
>

Jumping in a little late here, but: do you do anything else, later on, with
self.data?  If not, you could skip the "self.data = data" line and just do
your thing with "data"...

If you ARE doing something with it later on, of course, please disregard.
I just wanted to point out that not everything needs to be persisted, if
you're only using it once.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130624/d33a82e0/attachment.html>


More information about the Tutor mailing list