Re: Headcount

"Samuele Pedroni" <[email protected]>
Newsgroups gmane.comp.python.anygui.devel
Message-ID <006301c259b6$d0f2fae0$6d94fea9@newmexico>
From: Magnus Lie Hetland <[email protected]>
>
> Right. My first thought was to introduce yet another cusomisable
> mechanism for deciding which setFoos are excempt from the "if None"
> guard... But it seems that customisable things like these are
> proliferating, and I'm not sure if it's just a groove I can't get out
> of ;)
>
> But it is a possibility... I.e.:
>
>   if (not self.mustHaveWidget(attr)) or self.widget is not None:
>       # Set the attribute
>

that's a possibility.

> All getters can be protected, I guess.

They already are: in Proxy.pull there's a

        if not self.wrapper.widget: return

>
> And another thing: We could introduce a specific exception for
> handling this. I.e. the getter code could raise a NoWidgetException if
> we try to get an attribute before there's a widget; the front-end
> could ignore that, because the value would be in proxy.state. If we
> have something like the DummyWidget that raises this exception on all
> attribute accesses, that could be used instead of comparing with None
> too... But without much gain, I guess. (The None stuff is simple,
> clean, and easy to understand.)
>

You are all fond of exceptions but exceptions are slow <wink>., especially in
jython :(.
Anyway see above.

regards.



-------------------------------------------------------
In remembrance
www.osdn.com/911/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.