a couple of questions: pickling objects and strict types

Littlefield, Tyler tyler at tysdomain.com
Fri Apr 5 20:18:51 EDT 2013


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.




More information about the Python-list mailing list