c[:]()

Warren Stringer warren at muse.com
Wed May 30 17:31:23 EDT 2007


Hmmm, this is for neither programmer nor computer; this is for a user. If I
wanted to write code for the benefit for the computer, I'd still be flipping
switches on a PDP-8. ;-)

This is inconsistent: 

why does c[:][0]() work but c[:]() does not? 
Why does c[0]() has exactly the same results as c[:][0]() ? 
Moreover, c[:][0]() implies that a slice was invoked

So, tell me, for scheduling a lot of asynchronous events, what would be more
readable than this:
	
	bidders = [local_members] + [callin_members]
	bidders[:].sign_in(roster)
	...
	
\~/

> -----Original Message-----
> From: python-list-bounces+warren=muse.com at python.org [mailto:python-list-
> bounces+warren=muse.com at python.org] On Behalf Of Carsten Haese
> Sent: Wednesday, May 30, 2007 12:55 PM
> To: python-list at python.org
> Subject: Re: c[:]()
> 
> On Wed, 2007-05-30 at 11:48 -0700, Warren Stringer wrote:
> > I want to call every object in a tupple, like so:
> >
> > #------------------------------------------
> > def a: print 'a'
> > def b: print 'b'
> > c = (a,b)
> >
> > >>>c[:]()  # i wanna
> > [...]
> > Is there something obvious that I'm missing?
> 
> Yes: Python is not Perl.
> 
> Python is based on the principle that programmers don't write computer
> code for the benefit of the computer, but for the benefit of any
> programmer who has to read their code in the future. Terseness is not a
> virtue. To call every function in a tuple, do the obvious:
> 
> for func in funcs: func()
> 
> HTH,
> 
> --
> Carsten Haese
> http://informixdb.sourceforge.net
> 
> 
> --
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list