[Stackless] stackless.stackless

Christian Tismer tismer at stackless.com
Mon Apr 12 08:15:52 CEST 2010

On 3/26/10 11:40 AM, Kristján Valur Jónsson wrote:
> I just noticed that the stackless module has a an attribute 
> "stackless" that points to itself.
> This is highly irregular.  I noticed this because some of the tests in 
> stackless/test do
> from stackless import *
> and then proceed to do stuff such as
> r = stackless.channel()
> I'd like to remove this module self reference if no one objects.
The purpose of this irregularity was to be able to use
'from stackless import *'
and then to have access to the stackless module, still.
The module is irregular itself, because it has computed
attributes stackless.current and stackless.main.
They were added because they are slightly faster than
stackless.getcurrent() and stackless.getmain().

This was done in pre-property early days.
I think to remove computed attribute access from the
stackless module, but maybe add a python object
with the name stackless, instead, which has properties
main and current added? This would be very fast with
the new psyco support, which optimizes attribute access.

Well, I can imagine you won't like that, either.
Feel free to remove stackless.stackless, but then please
also remove the extra attribute access code and  make
stackless a real module.
The idea of computed module attributes was related to do
some additions, like having certain checks done, to prevent
overwriting of things and so on, but I don't think I did
much more than considering.

Btw., I don't like modules very much as they are. They
really should have the layout of a singleton class instance
with full control over attributes.

And while we are at it: We should also try to get rid of
the flextype module. It was done to provide faster access
to overridable attributes. But I think it is no longer
woth being carried around, and the concept was never
understood by anybody, I think.

It gives a bit of speedup for overridden methods, still,
but again, in the light of coming psyco for stackless,
this will become irrelevant, because in psyco, all those
method lookups will be resolved at compile time.

cheers - chris


Christian Tismer             :^)<mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key ->  http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20100412/e627900d/attachment.htm>

More information about the Stackless mailing list