On Fri, 02 Feb 2007 13:53:21 -0800, manstey wrote:
Hi,
There was a mistake above, and then I'll explain what we're doing:
insCacheClass = CacheClass(oref)
insCacheProperty = CacheProperty(insOref,'Chapter')
should have been
insCacheClass = CacheClass(oref)
insCacheProperty =
Hi,
There was a mistake above, and then I'll explain what we're doing:
insCacheClass = CacheClass(oref)
insCacheProperty = CacheProperty(insOref,'Chapter')
should have been
insCacheClass = CacheClass(oref)
insCacheProperty = CacheProperty(insCacheClass ,'Chapter')
Now, to answer some
Steven D'Aprano [EMAIL PROTECTED] writes:
def _accumulate_properties(self, properties):
self.properties = []
Probably better to put that in the __init__ method, otherwise if
somebody runs instance._accumulate_properties(...) again, it will
have the side-effect of
Thanks for your input. Here is my next version, which works very well,
but for one problem I explain below:
class CacheProperty(object):
def __init__(self, insCacheClass, name):
self.Name = name
self._bind_to_parent(insCacheClass)
self.__parent = insCacheClass
manstey [EMAIL PROTECTED] writes:
However, the problem is now that I can also write:
insOref.Chapter=67
but we want to disallow this, as insOref.Chapter must remain =
insProperty
Then don't do that.
Python allows any name to be reassigned to any value, with the
attitude of we're all
On Wed, 31 Jan 2007 20:15:44 +1100, Ben Finney wrote:
Steven D'Aprano [EMAIL PROTECTED] writes:
def _accumulate_properties(self, properties):
self.properties = []
Probably better to put that in the __init__ method, otherwise if
somebody runs
On Wed, 31 Jan 2007 15:09:29 -0800, manstey wrote:
Thanks for your input. Here is my next version, which works very well,
but for one problem I explain below:
class CacheProperty(object):
def __init__(self, insCacheClass, name):
self.Name = name
Hi Ben,
Could I also do something like the following? What does it mean to
store the parent class as a private variable in the child class?
class CacheProperty(object):
def __init__(self, obj, parent, properties=None):
self.__data = obj
self._parent = parent
manstey [EMAIL PROTECTED] writes:
Could I also do something like the following?
I can't immediately see a problem with the code you posted. Does it do
what you want it to do?
What does it mean to store the parent class as a private variable in
the child class?
I don't understand this
On Tue, 30 Jan 2007 21:15:53 -0800, manstey wrote:
Hi Ben,
Could I also do something like the following? What does it mean to
store the parent class as a private variable in the child class?
What it means is that references to self.__data (note the TWO leading
underscores) in your code
Hi,
I am having trouble designing my classes.
I have two classes. The first one wraps around an old-style class
called oref
Class CacheClass(object):
def __init__(self, obj):
self.__data = obj
def __getattr__(self, attr):
return getattr(self.__data, attr)
The second
manstey [EMAIL PROTECTED] writes:
I have two classes. The first one wraps around an old-style class
called oref
Class CacheClass(object):
def __init__(self, obj):
self.__data = obj
def __getattr__(self, attr):
return getattr(self.__data, attr)
I presume the 'obj'
12 matches
Mail list logo