Bruno Desthuilliers wrote:
class Prop(object):
... @apply
... def prop():
... def fget(self): return self._prop
... def fset(self, val): self._prop = val
... return property(**locals())
... def __init__(self, val): self.prop=val
...
class
On Aug 12, 7:28 pm, mwojc [EMAIL PROTECTED] wrote:
Hi!
My class with implemented __getattr__ and __setattr__ methods cannot be
pickled because of the Error:
Another option is to define __getstate__ on your class:
def __getstate__(self): return vars(self)
M.S.
--
mwojc a écrit :
Bruno Desthuilliers wrote:
class Prop(object):
... @apply
... def prop():
... def fget(self): return self._prop
... def fset(self, val): self._prop = val
... return property(**locals())
... def __init__(self, val): self.prop=val
...
class
Hi!
My class with implemented __getattr__ and __setattr__ methods cannot be
pickled because of the Error:
==
ERROR: testPickle (__main__.TestDeffnet2WithBiases)
looks for a couple special
method in your object[1], and it looks like it doesn't bother to check
if what it found was really callable.
[1] cf http://docs.python.org/lib/pickle-inst.html
FWIW, you'd be better using a property instead of __getattr__ /
__setattr__ if possible. And while we're
instead of __getattr__ /
__setattr__ if possible.
You're probably right again, in this case it's better to use property.
And while we're at it, you dont need to
manually take care of your index in the for loop - you can use
enumerate(iterable) instead:
for j, net in enumerate
mwojc a écrit :
Bruno Desthuilliers wrote:
(snip)
FWIW, you'd be better using a property instead of __getattr__ /
__setattr__ if possible.
You're probably right again, in this case it's better to use property.
Since you seem to have concerns wrt/ execution time, properties might
,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.3
Status: Closed
Resolution: Works For Me
Priority: 5
Submitted By: has (hhas)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python crash on __init__/__getattr__
,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.3
Status: Pending
Resolution: None
Priority: 5
Submitted By: has (hhas)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python crash on __init__/__getattr__
,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: has (hhas)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python crash on __init__/__getattr__/__setattr__
thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: has (hhas)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python crash on __init__/__getattr__
Just wondering about this behaviour, why is it this way?
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
Type help, copyright, credits or license for more information.
object.__setattr__
slot wrapper '__setattr__' of 'object' objects
object.__getattr__
Traceback
for new style classes __getattribute__ is defined, see eg.
http://www.python.org/2.2.3/descrintro.html
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Heller wrote:
Just wondering about this behaviour, why is it this way?
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
Type help, copyright, credits or license for more information.
object.__setattr__
slot wrapper '__setattr__' of 'object' objects
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
for new style classes __getattribute__ is defined, see eg.
http://www.python.org/2.2.3/descrintro.html
Steve Holden [EMAIL PROTECTED] writes:
object.__getattribute__
slot wrapper '__getattribute__' of 'object' objects
Ring any bells?
Yes, of
15 matches
Mail list logo