Re: how to break a for loop?

2006-02-21 Thread bonono
Giovanni Bajo wrote: > [EMAIL PROTECTED] wrote: > > >> I need to remove zeros from > >> the begining of list, but I can't :-(. > > > > I believe the following is almost a direct translation of the above > > sentence. > > > > import itertools as it > > a=[0,0,0,1,0] > > a[:]=it.dropwhile(lambda x:

Re: In need of a virtual filesystem / archive

2006-02-21 Thread bonono
Steven D'Aprano wrote: > I suspect you can pick any two of the following three: > > 1. single file > 2. space used for deleted files is reclaimed > 3. fast performance > > Using a proper database will give you 2 and 3, but at > the cost of a lot of overhead, and typically a > relational database i

Re: Little tool - but very big size... :-(

2006-02-21 Thread bonono
11MB is seldom a concern for today's machine. Durumdara wrote: > Hi ! > > I have a problem. > I have a little tool that can get data about filesystems and wrote it in > python. > > The main user asked me a GUI for this software. > > This user is needed a portable program, so I create this kind of

Re: Little tool - but very big size... :-(

2006-02-21 Thread bonono
I doubt you can do much then as you mentioned you need GUI which is why there is the GUI related dll in the list(takes a large chunk of it), then the necessary python runtime. However, even for USB pen, I don't think 11M is that much a big deal. We have digicam that can produce file size like that

Re: how to break a for loop?

2006-02-21 Thread bonono
[EMAIL PROTECTED] wrote: > This time it seems that using itertools gives slower results, this is > the test code: Understandable, as dropwhile still needs to go through the whole list and the difference will be larger when the list get longer. Though I still prefer that if the list is not horribly

Re: Basic coin flipper program - logical error help

2006-02-21 Thread bonono
John Zenger wrote: > Also, with the functional programming tools of map, filter, and lambda, > this code can be reduced to just six lines: > > import random > > flips = map(lambda x: random.randrange(2), xrange(100)) > heads = len(filter(lambda x: x is 0, flips)) > tails = len(filter(lambda x: x i

Re: A C-like if statement

2006-02-23 Thread bonono
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote: > > >> try: > >>i = a.find("3") > >>print "It's here: ", i > >> except NotFound: > >>print "No 3's here" > > > > Nuts. I guess you're right. It wouldn't be proper. Things are added or > > proposed every

Re: "Temporary" Variable

2006-02-24 Thread bonono
Steven D'Aprano wrote: > Just out of curiosity, when do you think is the right time to begin > teaching programmers good practice from bad? Before or after they've > learnt bad habits? When you have authority over the coding guideline. Naming things is not something limited to programming and most

Re: A C-like if statement

2006-02-24 Thread bonono
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 16:49:09 -0800, bonono wrote: > > > > > Steven D'Aprano wrote: > >> On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote: > >> > >> >> try: > >> >>i = a.find("3"

Re: Is Python a Zen language?

2006-02-25 Thread bonono
don't know but there is "Zen of Python". -- http://mail.python.org/mailman/listinfo/python-list

Re: Optimize flag question

2006-02-25 Thread bonono
Steve Holden wrote: > > Some other functions rely on the AssertionError exception to indicate to > > the user that something went wrong instead of using a user defined > > exception. > > > > The real problem here is that you appear to be using AssertionError in > an inappropriate way. If some call

Re: Is Python a Zen language?

2006-02-26 Thread bonono
André wrote: > Some "purist", like the Academie Francaise (or, apparently "Crutcher") > seem to believe that "one" can restrict the meaning of words, or the > evolution of language. The rest of us are happy to let language > evolution take place to facilitate communication. So instead of Zen of

<    1   2   3