2001 Enchancement Wishlist
Alex Martelli
aleaxit at yahoo.com
Tue Jan 2 16:16:42 EST 2001
"Thomas Wouters" <thomas at xs4all.net> writes:
> > > already has a framework for creating exactly one instance of
> > > something: the module namespace).
> >
> > Pity that isn't as flexible as an object-instance -- can't define
> > special methods to determine how it will print, how it will
> > let usercode loop on its items, etc.
>
> Of course it can.
The module can define a class-instance object (which can in turn
do these nice things), but it can't do them itself -- as you know
perfectly well, so it's peculiar that you would say otherwise.
> <spammodule.py>
> class _singleton:
> <whatever you want>
>
> SingleTon = _singleton()
>
> All that is required is for everyone to use spammodule.SingleTon.
So, if somebody complains that a Python lambda cannot contain
a for loop, will you answer "of course it can" in that it can (e.g.)
call a function which, in turn, IS able to contain such loops?
I find this unfunny and unconstructive. Limitations of Python
modules in terms of special-methods are quite real, and
slightly annoying, and trying to "define them away as
limitations" via such attempted (and not particularly subtle)
verbal sleight of hand leads nowhere interesting.
Alex
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
More information about the Python-list
mailing list