Re: Increment Variable Name

2008-01-23 Thread Pablo Ziliani
David Brochu wrote: > Pablo - Thanks for the reply. > > Basically what I am trying to do is pass each value from a list to the > following line of code (where XXX is where I need to pass each value > of the list > > tests = easygui.multchoicebox(message="Pick the test(s) you would like > to run

Re: Increment Variable Name

2008-01-23 Thread Pablo Ziliani
Ben Finney wrote: > This has a very bad code smell (...) > > \ `\ _o__) Ben Finney That is forcefulness. (sorry, couldn't resist) -- http://mail.python.org/mailman/listinfo/python-list

Re: Increment Variable Name

2008-01-23 Thread Pablo Ziliani
Hi David, David Brochu wrote: > I know the length of a list and I want to pass each element of a list > to a unique variable, thus I want to increment variable names. If the > list length = 4, i want to have the following variables: var1, var2, > var3, var4. yuck... no, believe me, you prob

Re: alternating string replace

2008-01-11 Thread Pablo Ziliani
Paul Rubin wrote: > George Sakkis <[EMAIL PROTECTED]> writes: > >> from itertools import chain, izip, cycle >> print ''.join(chain(*izip(s1.split('_'),cycle(':,'[:-1] >> > > from itertools import cycle > a = cycle(':,') > print re.sub('_', lambda x: a.next(), s1) > Lovely. If there

Re: alternating string replace

2008-01-09 Thread Pablo Ziliani
cesco wrote: > Hi, > > say I have a string like the following: > s1 = 'hi_cat_bye_dog' > and I want to replace the even '_' with ':' and the odd '_' with ',' > so that I get a new string like the following: > s2 = 'hi:cat,bye:dog' > Is there a common recipe to accomplish that? I can't come up with

Re: Python's great, in a word

2008-01-07 Thread Pablo Ziliani
Dustan wrote: > On Jan 7, 11:40 am, Martin Marcher <[EMAIL PROTECTED]> wrote: > >> it's pythonicness. >> > > "it is pythonicness"??? > Obviously a typo, for "It is pythonic, Ness". A reference to the well-known Loch Ness Monster, definitely pythonic if you see some pictures: http://ima

Re: Python's great, in a word

2008-01-07 Thread Pablo Ziliani
[EMAIL PROTECTED] wrote: > Would you Python old-timers try to agree on a word or two that > completes: > > The best thing about Python is ___. Hi Martin, here is my top three: 1) Fun 2) Simplicity 3) Productivity -- http://mail.python.org/mailman/listinfo/python-list

Re: searching a value of a dict (each value is a list)

2007-12-09 Thread Pablo Ziliani
Seongsu Lee escribió: > Hi, > > I have a dictionary with million keys. Each value in the > dictionary has a list with up to thousand integers. > (...) > > I want to find out the key value which has a specific > integer in the list of its value. Sorry if this is unhelpful, but have you considered m

Re: reading list of list to a file

2007-12-09 Thread Pablo Ziliani
Hi Croliina, caroliina escribió: > i made a list of lists Please notice that this problem: > but i cant write it into a file. has nothing to do with this other one: > how do i get the > first string in a sublist? > For the first one, it is impossible to answer without seeing some actual co

Re: List Question

2007-10-02 Thread Pablo Ziliani
Paul Hankin wrote: > On Oct 2, 10:06 pm, brad <[EMAIL PROTECTED]> wrote: > >> How is this expressed in Python? >> >> If x is in y more than three times: >> print x >> >> y is a Python list. >> > > Simple and readable: > if len([a for a in y if x == a]) > 3: > print x > > Or the sli

Re: Program inefficiency?

2007-09-29 Thread Pablo Ziliani
thebjorn wrote: On Sep 29, 7:55 pm, Pablo Ziliani <[EMAIL PROTECTED]> wrote: thebjorn wrote: Ugh, that was entirely too many regexps for my taste :-) Oh yeah, now it's clear as mud. I'm anxiously awaiting your beacon of clarity ;-) Admittedly, that was a b

Re: strange unbound local error?

2007-09-29 Thread Pablo Ziliani
[EMAIL PROTECTED] wrote: > spam = 42 > > def eggs(): > print spam > spam = spam + 1 > > if __name__=="__main__": > eggs() > > This thows an UnboundLocalError at line 4 (print statement). But if I > comment out line 5 (variable assignment), no error occurs. > > Can you explain me this, p

Re: Program inefficiency?

2007-09-29 Thread Pablo Ziliani
thebjorn wrote: > On Sep 29, 5:22 pm, [EMAIL PROTECTED] wrote: > >> I wrote the following simple program to loop through our help files >> and fix some errors (in case you can't see the subtle RE search that's >> happening, we're replacing spaces in bookmarks with _'s) >> (...) >> > > Ugh,

Re: Program inefficiency?

2007-09-29 Thread Pablo Ziliani
[EMAIL PROTECTED] wrote: > Is there a solution here that I'm missing? What am I doing that is so > inefficient? > Hi Jeff, Yes, it seems you have plenty of performance leaks. Please see my notes below. > def massreplace(): > editfile = open("pathname\editfile.txt") > filestring = edit

Re: ValueError: too many values to unpack

2007-09-27 Thread Pablo Ziliani
Zentrader wrote: > On Sep 27, 9:46 am, Shawn Minisall <[EMAIL PROTECTED]> wrote: > >> line 3 - 19.1829.1578.75212.10 >> line 4 - 10020410.29 >> And this is the code I'm using: >> >>#read withdrawls from file on line3 >>line = infile.readline() >> #split withdrawl

Re: regex with specific list of string

2007-09-26 Thread Pablo Ziliani
Carsten Haese wrote: > On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote: >> james_027 wrote: >>> hi, >>> >>> how do I regex that could check on any of the value that match any one >>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >>> 'sep', 'oct', 'nov', 'dec' >>> >>> Th

Re: regex with specific list of string

2007-09-26 Thread Pablo Ziliani
Carsten Haese wrote: > On Wed, 2007-09-26 at 15:42 +, james_027 wrote: > >> hi, >> >> how do I regex that could check on any of the value that match any one >> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', >> 'sep', 'oct', 'nov', 'dec' >> > > Why regex? You can si

[OT] Python Argentina T-shirt to exchange

2006-06-17 Thread Pablo Ziliani
Hi guys, sorry for this _very_ off-topic message. I'll be in Paris, France next week and I thought someone there might be interested to exchange this http://www.python.com.ar/moin/Remeras T-shirt (size M) with me? I'd really like to take home a py-french (or wherever) one instead. Thanks and s