2001 Enchancement Wishlist

Thomas Wouters thomas at xs4all.net
Thu Jan 4 10:51:16 EST 2001


On Tue, Jan 02, 2001 at 10:16:42PM +0100, Alex Martelli wrote:
> "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.

I'm afraid I don't understand the difference. Are you saying a class can't
pretend to be a list by encapsulating it, because it wouldn't do the work
itself ? Or that it can't do string operations because it doesn't do the
operations itself, but rather asks the string object to do them (in 2.0) or
asks the strop module to do it (before 2.0) ?

> > <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?

Again, I don't see the difference. I'm sorry that I apparently pissed you
off by explaining what I thought /F meant, but I can honestly say this is
the first time I've been flamed without undestanding why :) Lambda's cannot
contain 'for' loops, but you can do a 'for' loop from a lambda, by
'encapsulating' it in a function. Python lacks closures, but they can be
faked using default-arguments. Python doesn't have Perl's 'm//' or
'while(<>)', but you can achieve the same effect through the re and
fileinput modules. Python lacks C's ability to do '*(0) = 42', but you can
achieve a similar effect by using the signal module ;P

What, exactly, are you objecting to ? That everything in Python is an
object instance, whether you want it or not ?

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list