On Déardaoin, Ean 27, 2005, at 19:25 America/Chicago, Jeff Shannon
wrote:
Okay, so size (and the B object) is effectively a class attribute,
rather than an instance attribute. You can do this explicitly --
Ah, now I'm getting there. That does the trick.
Probably not worth the trouble in this pa
Christian Dieterich wrote:
On Déardaoin, Ean 27, 2005, at 14:05 America/Chicago, Jeff Shannon wrote:
the descriptor approach does. In either case, the calculation happens
as soon as someone requests D.size ...
Agreed. The calculation happens as soon as someone requests D.size. So
far so good.
On Déardaoin, Ean 27, 2005, at 14:05 America/Chicago, Jeff Shannon
wrote:
True, in the sense that B is instantiated as soon as a message is sent
to D that requires B's assistance to answer. If the "decision" is a
case of "only calculate this if we actually want to use it", then this
lazy-cont
Christian Dieterich wrote:
On Dé Céadaoin, Ean 26, 2005, at 17:09 America/Chicago, Jeff Shannon wrote:
You could try making D a container for B instead of a subclass:
Thank you for the solution. I'll need to have a closer look at it.
However it seems like the decision whether to do "some expensiv
On Dé Céadaoin, Ean 26, 2005, at 17:02 America/Chicago, Steven Bethard
wrote:
Just a note of clarification:
The @deco syntax is called *decorator* syntax.
Classes with a __get__ method are called *descriptors*.
Okay, I think I get the idea. I didn't know about the @deco syntax, but
it seems to b
Christian Dieterich wrote:
Hi,
I need to create many instances of a class D that inherits from a class
B. Since the constructor of B is expensive I'd like to execute it only
if it's really unavoidable. Below is an example and two workarounds, but
I feel they are not really good solutions. Does s
Christian Dieterich wrote:
On Dé Céadaoin, Ean 26, 2005, at 13:45 America/Chicago, Steven Bethard
wrote:
Note that:
@deco
def func(...):
...
is basically just syntactic sugar for:
def func(...):
...
func = deco(func)
Oh, I learned something new today :-) Nice thin
On Dé Céadaoin, Ean 26, 2005, at 13:45 America/Chicago, Steven Bethard
wrote:
Note that:
@deco
def func(...):
...
is basically just syntactic sugar for:
def func(...):
...
func = deco(func)
Oh, I learned something new today :-) Nice thing to know, these
descriptor
Christian Dieterich wrote:
The size attribute only needs to be computed once and stays constant
after that. The lazy property recipe of Scott David Daniels looks
promising. I'll try that, when I've installed Python 2.4. However, I
need my package to work on machines where there is Python 2.2 and
On Dé Céadaoin, Ean 26, 2005, at 11:46 America/Chicago, Steven Bethard
wrote:
I'm confused as to how you can tell when it's avoidable... Do you
mean you don't want to call 'method' if you don't have to? Could you
make size a property, e.g.
Then 'size' won't be calculated until you actually u
Christian Dieterich wrote:
I need to create many instances of a class D that inherits from a class
B. Since the constructor of B is expensive I'd like to execute it only
if it's really unavoidable. Below is an example and two workarounds, but
I feel they are not really good solutions. Does someb
Christian Dieterich wrote:
Hi,
I need to create many instances of a class D that inherits from a class
B. Since the constructor of B is expensive I'd like to execute it only
if it's really unavoidable. Below is an example and two workarounds, but
I feel they are not really good solutions. Does s
Hi,
I need to create many instances of a class D that inherits from a class
B. Since the constructor of B is expensive I'd like to execute it only
if it's really unavoidable. Below is an example and two workarounds,
but I feel they are not really good solutions. Does somebody have any
ideas how
13 matches
Mail list logo