Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42866

Re: a couple of questions: pickling objects and strict types

Date 2013-04-05 18:18 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
Subject Re: a couple of questions: pickling objects and strict types
References <mailman.159.1365188823.3114.python-list@python.org> <515f345a$0$29995$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.170.1365207530.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 4/5/2013 2:30 PM, Steven D'Aprano wrote:
> On Fri, 05 Apr 2013 12:59:04 -0600, Littlefield, Tyler wrote:
>
>> Hello all:
>> I've been using Python for a while now, but I have one larger problem. I
>> come from a c++ background; though it doesn't help in catching runtime
>> errors, being able to compile a program helps catch a lot of syntax
>> errors. I know about pychecker, which is somewhat useful. Do people have
>> other methods for handling this?
>
> Do you tend to make a lot of syntax errors?
Not a -lot-, but there are things I don't catch sometimes.

> Python also catches syntax errors at compile-time. I won't speak for
> others, but I hardly ever make syntax errors: between Python's simple,
> surprise-free syntax, and modern, syntax-colouring editors, I find that I
> rarely make syntax errors.

I am blind, so colorful editors don't really work all that well for me.

>> Also, I'm depickling objects. Is there a way I can force pickle to call
>> the object's ctor? I set up events per object, but when it just
>> deserializes it doesn't set all that up. Thanks,
> What's the object's ctor? What sort of objects are you dealing with?
>
>
>
     def __init__(self):
         self.events = {}
         self.components = []
         self.contents = []
         self.uid = uuid4().int
         self.events['OnLook'] = teventlet()


Basically events don't get initialized like I'd like after I depickle 
objects.

-- 
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

a couple of questions: pickling objects and strict types "Littlefield, Tyler" <tyler@tysdomain.com> - 2013-04-05 12:59 -0600
  Re: a couple of questions: pickling objects and strict types John Gordon <gordon@panix.com> - 2013-04-05 19:27 +0000
  Re: a couple of questions: pickling objects and strict types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-05 20:30 +0000
    Re: a couple of questions: pickling objects and strict types "Littlefield, Tyler" <tyler@tysdomain.com> - 2013-04-05 18:18 -0600
      Re: a couple of questions: pickling objects and strict types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-06 02:37 +0000
        Re: a couple of questions: pickling objects and strict types Chris Angelico <rosuav@gmail.com> - 2013-04-06 13:49 +1100
        Re: a couple of questions: pickling objects and strict types Dave Angel <davea@davea.name> - 2013-04-05 23:22 -0400
        Re: a couple of questions: pickling objects and strict types mblume <foobar@invalid.invalid> - 2013-04-06 10:30 +0000

csiph-web