Import Issue

2006-06-01 Thread praveenkumar . 117
Hi all, I am facing a problem while importing a file in python script. After doing import file i am updating that file. Later i am accessing a dictionary contained in that file. Eventhough changes are reflected in the file... When i access a dictionary those changes

Re: grouping a flat list of number by range

2006-06-01 Thread Paddy
Jim Segrave wrote: > In article <[EMAIL PROTECTED]>, > Paddy <[EMAIL PROTECTED]> wrote: > > > >What I ran was more like the version below, but i did a quick > >separation of the line that has the ';' in it and goofed. > > > def interv2(inlist): > >... for i,val in enumerate(inlist): > >...

Re: Are there something like "Effective Python"?

2006-06-01 Thread BartlebyScrivener
>> I just finished reading Learning Python 3rd ed, For real? I thought there was only a 2nd edition. http://www.oreilly.com/catalog/lpython2/ -- http://mail.python.org/mailman/listinfo/python-list

Re: C# equivalent to range()

2006-06-01 Thread Michel Claveau
Hi! > There are thousands of threads to choose from in this forum. > If they didn't like this question, they could have picked any other one > to discuss. > There's no need to be disagreeable :-) I think the same thing. -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listi

Re: Are there something like "Effective Python"?

2006-06-01 Thread Ray
I think Aahz stated somewhere that he was workign on Effective Python. I'm not sure if it's an ongoing plan or it's been canned though? Mike Meng wrote: > Hi all, > I just finished reading Learning Python 3rd ed, and am doing my > first Python application, which retrieves and process text a

Re: image lib & Qt4

2006-06-01 Thread Fredrik Lundh
Fredrik Lundh wrote: > To get better performance, you should be able to use PIL's tostring() > method together with the QImage(buffer, width, height, depth, > colortable, numColors, bitOrder) form of the QImage constructor. for PyQt4, that seems to have changed to QImage(buffer, width, height,

Re: grouping a flat list of number by range

2006-06-01 Thread Gerard Flanagan
Gerard Flanagan wrote: > [EMAIL PROTECTED] wrote: > > hello, > > > > i'm looking for a way to have a list of number grouped by consecutive > > interval, after a search, for example : > > > > [3, 6, 7, 8, 12, 13, 15] > > > > => > > > > [[3, 4], [6,9], [12, 14], [15, 16]] > > > > (6, not following 3

Re: Are there something like "Effective Python"?

2006-06-01 Thread Luis M. González
Mike Meng wrote: > Hi all, > I just finished reading Learning Python 3rd ed, and am doing my > first Python application, which retrieves and process text and XML > documents from Web. Python helped me to write the application in a few > hours, I'm very happy with its productivity. But the pe

Re: grouping a flat list of number by range

2006-06-01 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > hello, > > i'm looking for a way to have a list of number grouped by consecutive > interval, after a search, for example : > > [3, 6, 7, 8, 12, 13, 15] > > => > > [[3, 4], [6,9], [12, 14], [15, 16]] > > (6, not following 3, so 3 => [3:4] ; 7, 8 following 6 so 6, 7, 8 => >

Re: C# equivalent to range()

2006-06-01 Thread Luis M. González
Erik Max Francis wrote: > Yeah, what jerks. They actually wanted to talk about Python, not some > random other language that you're trying to learn that has nothing to do > with it ... There are thousands of threads to choose from in this forum. If they didn't like this question, they could have

Re: Inheritance structure less important in dynamic languages?

2006-06-01 Thread Ben Finney
"Marvin" <[EMAIL PROTECTED]> writes: > It's been claimed that inheritance structures are less important in > dynamic languages like Python. Who claimed that? I ask not because I doubt your assertion ("it was claimed"), but rather that if someone claimed something, it seems better to ask that pers

Re: C# equivalent to range()

2006-06-01 Thread Erik Max Francis
Neuruss wrote: > I thougt that maybe some python programmer could have experience here > with c# and give me a little hint. > > But unfortunately, there are people here who are not willing to waste > their time helping, but enjoy to waste their time niggling... Yeah, what jerks. They actually w

Are there something like "Effective Python"?

2006-06-01 Thread Mike Meng
Hi all, I just finished reading Learning Python 3rd ed, and am doing my first Python application, which retrieves and process text and XML documents from Web. Python helped me to write the application in a few hours, I'm very happy with its productivity. But the performance is not satisfacto

Re: image lib & Qt4

2006-06-01 Thread Fredrik Lundh
aljosa wrote: > does anybody know how to load (in-memory > representation of PNG image) from Qt (v.4.1.3) as QImage? If you want the data from a StringIO object, you can either *read* the data from the object (it's a file-like object, after all), or use the getvalue() method. Something like

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread A.M
Well the work is done now. I arrived home at 10:30 PM. The application takes data from Oracle 10g stored procedures and renders data to both HTML and CSV formats. The HTML reports have summary and grouping sections and the HTML files are Excel friendly. The application is modular and consis

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread D H
A.M wrote: > Hi, > > Is there any built in feature in Python that can format long integer > 123456789 to 12,3456,789 ? Apparently you need to use the locale module. This is the example they give online to print a simple number with commas: import locale locale.setlocale(locale.LC_ALL, 'English

Re: C# equivalent to range()

2006-06-01 Thread John Machin
Neuruss wrote: > John Machin wrote: > > Neuruss wrote: > > > I'm sorry for asking about another language here, but since I only know > > > Python and I'm trying to write something in C#, I guess this is the > > > best place... > > > > > > > Bad guess. Ask questions about language X on comp.lang.X

Re: C# equivalent to range()

2006-06-01 Thread Neuruss
Thank you DH!! D H wrote: > Neuruss wrote: > > I'm sorry for asking about another language here, but since I only know > > Python and I'm trying to write something in C#, I guess this is the > > best place... > > > > I'd like to know how to write this in C#: > > > > x=[] > > sz = 1000 > > x.

Re: C# equivalent to range()

2006-06-01 Thread Neuruss
John Machin wrote: > Neuruss wrote: > > I'm sorry for asking about another language here, but since I only know > > Python and I'm trying to write something in C#, I guess this is the > > best place... > > > > Bad guess. Ask questions about language X on comp.lang.X Well, perhaps I should. And I s

Re: C# equivalent to range()

2006-06-01 Thread D H
Neuruss wrote: > I'm sorry for asking about another language here, but since I only know > Python and I'm trying to write something in C#, I guess this is the > best place... > > I'd like to know how to write this in C#: > > x=[] > sz = 1000 > x.extend(range(sz)) > > My question is about "ra

Re: is a wiki engine based on a cvs/svn a good idea?

2006-06-01 Thread R. P. Dillon
TWiki, written in perl, makes extensive use of versioning/diff functionality you mention through the use of RCS, which, IIRC, is the basis for CVS. This method eliminates the need for the repository as such, and merely requires the presence of the RCS files (and RCS). Unless you _want_ to host

Re: C# equivalent to range()

2006-06-01 Thread Ben Finney
"Neuruss" <[EMAIL PROTECTED]> writes: > I'm sorry for asking about another language here, but since I only > know Python and I'm trying to write something in C#, I guess this is > the best place... Really, it isn't. Post in a C# discussion forum, describing the behaviour you want from your progra

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Alex Martelli
Slawomir Nowaczyk <[EMAIL PROTECTED]> wrote: > On Thu, 01 Jun 2006 15:12:23 -0700 > [EMAIL PROTECTED] wrote: > > #> I believe that 'is' tests equality of reference, such that > #> > #> >>> a = range(1,3) > #> >>> b = range(1,3) > #> >>> a is b > #> False > #> > #> The 'is' operator tells you wh

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Alex Martelli
Slawomir Nowaczyk <[EMAIL PROTECTED]> wrote: > On Thu, 01 Jun 2006 13:40:34 -0700 > [EMAIL PROTECTED] wrote: > > #> Scott David Daniels wrote: > #> > Would you say that envelope containing five $100 bills is equal to > #> > an envelope containing five $100 bills with different serial numbers? >

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > I agree with Alex that checking for this type of inequality is not a > trivial programming exercise. It requires (at least) a parallel I'm not asking for ANY programming: I'm asking for a *straightforward operational definition*. If the concept which you hanke

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Hi Alex, > With all due respect to your well-deserved standing in the Python > community, I'm not convinced that equality shouldn't imply invariance > under identical operations. So, why aren't you satisfying my request? Provide a simple concrete definition of what y

Re: Best Python Editor

2006-06-01 Thread Terry Hancock
Fredrik Lundh wrote: > "Manoj Kumar P" wrote: > > Can anyone tell me a good python editor/IDE? > emacs! [...] Fredrik Lundh wrote: > "Manoj Kumar P" wrote: > > Can anyone tell me a good python editor/IDE? > vim! There is much truth in this man's replies. ;-D Cheers, Terry -- Terry Hancock

Re: C# equivalent to range()

2006-06-01 Thread John Machin
Neuruss wrote: > I'm sorry for asking about another language here, but since I only know > Python and I'm trying to write something in C#, I guess this is the > best place... > Bad guess. Ask questions about language X on comp.lang.X -- http://mail.python.org/mailman/listinfo/python-list

C# equivalent to range()

2006-06-01 Thread Neuruss
I'm sorry for asking about another language here, but since I only know Python and I'm trying to write something in C#, I guess this is the best place... I'd like to know how to write this in C#: x=[] sz = 1000 x.extend(range(sz)) My question is about "range" and "extend". Is there any equiv

Inheritance structure less important in dynamic languages?

2006-06-01 Thread Marvin
Hi, It's been claimed that inheritance structures are less important in dynamic languages like Python. Why is that and where can i read more about that? /Marv -- http://mail.python.org/mailman/listinfo/python-list

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread gregarican
Dear A.M., The day is complete. My TPS reports still aren't on my desk. Either with or without cover sheets. Not a good time to try to teach yourself a new language. Please gather your belongings and move down to basement storage C. That'd be great, Bill Lumberg John Machin wrote: > A.M wrote: >

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread A.M
Thanks for help. Is there any comprehensive library for number formatting available on the net? Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter - changing existing Dialog?

2006-06-01 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Michael Yanowitz <[EMAIL PROTECTED]> wrote: . . . >2) Change the text of a label or button that is already drawn? > > based on actions taken by the user. Can it be done without destroying >the p

Re: Tkinter - changing existing Dialog?

2006-06-01 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Michael Yanowitz <[EMAIL PROTECTED]> wrote: >Hello: > > > I have a Tkinter GUI Dialog with many buttons and labels and text >widgets. >What I would like to do is, can I: > >1) Disable/deactivate/hide a button, text widget that is already drawn (and > of course th

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread John Machin
[EMAIL PROTECTED] wrote: > A.M wrote: > > Hi, > > > > Is there any built in feature in Python that can format long integer > > 123456789 to 12,3456,789 ? > > > > Thank you, > > Alan > > I did this for putting commas into monetary amounts (thus the .2f): > > def commas(value): > return "".j

Re: execfile then import back

2006-06-01 Thread overly . crazy . steve
> ## x.py and y.py (they are identical) ## > import testexec > print "1:", v, testexec.v > testexec.v = 7 Oops, testexec should be changed to t instead. That is: ## x.py and y.py (they are identical) ## import t print "1:", v, t.v t.v = 7 -- http://mail.python.or

execfile then import back

2006-06-01 Thread overly . crazy . steve
I am seeing something strange with execfile. I've simplified the code to: ## t.py ## print "here" v = None def f(): global v v = 6 if __name__ == "__main__": f() print "0:", v execfile("x.py") print "0:", v execfile("y.py") print "0:", v #

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread Ben Cartwright
John Machin wrote: > A.M wrote: > > Hi, > > > > Is there any built in feature in Python that can format long integer > > 123456789 to 12,3456,789 ? > > > > Sorry about my previous post. It would produce 123,456,789. > "12,3456,789" is weird -- whose idea PHB or yours?? If it's not a typo, it's pro

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread james . wondrasek
A.M wrote: > Hi, > > Is there any built in feature in Python that can format long integer > 123456789 to 12,3456,789 ? > > Thank you, > Alan I did this for putting commas into monetary amounts (thus the .2f): def commas(value): return "".join(commafy("%.2f" % value)) def commafy(s):

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread Ben Cartwright
A.M wrote: > Is there any built in feature in Python that can format long integer > 123456789 to 12,3456,789 ? The locale module can help you here: >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'English_United States.1252' >>> locale.format('%d', 123456789, True) '123,456,78

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread John Machin
A.M wrote: > Hi, > > Is there any built in feature in Python that can format long integer > 123456789 to 12,3456,789 ? > Sorry about my previous post. It would produce 123,456,789. "12,3456,789" is weird -- whose idea PHB or yours?? -- http://mail.python.org/mailman/listinfo/python-list

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread John Machin
A.M wrote: > The application is not mission critical system. It is just a simple > reporting tool. Famous last words. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread John Machin
On 2/06/2006 9:08 AM, A.M wrote: > Hi, > > Is there any built in feature in Python that can format long integer > 123456789 to 12,3456,789 ? > > Thank you, > Alan Not that I know of, but this little kludge may help: 8<--- import re subber = re.compile(r'^(-?\d+)(\d{3})').sub def fmt_thousands

Re: Recommendations for CD/DVD-based or on-line Python classes?

2006-06-01 Thread Scott David Daniels
Joel Kolstad wrote: > Just curious... I have plenty of programming background (C++ being the > closest > to Python), and I have a copy of Lutz's "Learning Python," but before I dive > head-first into that tome, does anyone know of a web-based or CD/DVD-based > training class that's priced for i

Re: grouping a flat list of number by range

2006-06-01 Thread John Machin
On 2/06/2006 8:36 AM, Paddy wrote: > [EMAIL PROTECTED] wrote: >> hello, >> >> i'm looking for a way to have a list of number grouped by consecutive >> interval, after a search, for example : >> >> [3, 6, 7, 8, 12, 13, 15] >> >> => >> >> [[3, 4], [6,9], [12, 14], [15, 16]] >> >> (6, not following 3,

Re: Replace one element of a tuple (LONG)

2006-06-01 Thread Captain Dondo
BartlebyScrivener wrote: >>>that one column is always the same, the name of the host that >>>the database resides on. > > > Then why are you pulling all of the other stuff out of the db? Why > don't you just > > UPDATE tablename > SET hostname(or colname) = 'localhost' > WHERE search con

Re: Replace one element of a tuple (LONG)

2006-06-01 Thread BartlebyScrivener
>> that one column is always the same, the name of the host that >> the database resides on. Then why are you pulling all of the other stuff out of the db? Why don't you just UPDATE tablename SET hostname(or colname) = 'localhost' WHERE search condition = the rows you want to change --

Recommendations for CD/DVD-based or on-line Python classes?

2006-06-01 Thread Joel Kolstad
Just curious... I have plenty of programming background (C++ being the closest to Python), and I have a copy of Lutz's "Learning Python," but before I dive head-first into that tome, does anyone know of a web-based or CD/DVD-based training class that's priced for individuals? Example of what I'

Re: Conditional Expressions in Python 2.4

2006-06-01 Thread Robert Kern
A.M wrote: > Do we have the conditional expressions in Python 2.4? No. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://

Can Python format long integer 123456789 to 12,3456,789 ?

2006-06-01 Thread A.M
Hi, Is there any built in feature in Python that can format long integer 123456789 to 12,3456,789 ? Thank you, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope / Plone Groups

2006-06-01 Thread Rene Pijlman
[EMAIL PROTECTED]: >are there any specific groups for zope / plone regarding questions? Try plone-users: http://plone.org/support -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Conditional Expressions in Python 2.4

2006-06-01 Thread A.M
Hi, I am using Python 2.4. I read the PEP 308 at: http://www.python.org/dev/peps/pep-0308/ I tried the statement: a= "Yes" if 1==1 else "No" but the interpreter doesn't accept it. Do we have the conditional expressions in Python 2.4? Thank you, Alan -- http://mail.python.org/

Re: grouping a flat list of number by range

2006-06-01 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: > >What I ran was more like the version below, but i did a quick >separation of the line that has the ';' in it and goofed. > def interv2(inlist): >...for i,val in enumerate(inlist): >...if i==0: >...

Re: grouping a flat list of number by range

2006-06-01 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: >I did a little re-arranging of the generator version: > >def interv3(inlist): >tmp = inlist[0] >valinc = tmp+1 >for val in inlist[1:]: >if val != valinc: >yield [tmp, valinc]; >tmp = val >

Re: Replace one element of a tuple (LONG)

2006-06-01 Thread Captain Dondo
Brian wrote: > Captain Dondo wrote: > >>What I'd like to do is build the correct selectlist in the first place, >>rather than build the wrong one and then rebuild a correct one. > > > This is sounding more like a SQL/DB problem and less like a Python one. > If you have a field that is being pul

Re: if not CGI:

2006-06-01 Thread Bruno Desthuilliers
Max a écrit : (snip) > But now I'm ready to do it in the real world. Nothing complicated, but a > real project. And I have to choose my tools. Zope, Plone, Django, what > are these? Zope -> an application server Plone -> a CMS built upon Zope Django -> a MVC fullstack framework (fullstack : int

Re: grouping a flat list of number by range

2006-06-01 Thread Paddy
Jim Segrave wrote: > In article <[EMAIL PROTECTED]>, > Paddy <[EMAIL PROTECTED]> wrote: > >=== interv2 === > def interv2(inlist): > >... for i,val in enumerate(inlist): > >... if i==0: > >... tmp = val > >... elif val != valinc: > >... yiel

Re: grouping a flat list of number by range

2006-06-01 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: >=== interv2 === def interv2(inlist): >...for i,val in enumerate(inlist): >...if i==0: >...tmp = val >...elif val != valinc: >...yield [tmp, valinc] >...

Re: Replace one element of a tuple (LONG)

2006-06-01 Thread Brian
Captain Dondo wrote: > What I'd like to do is build the correct selectlist in the first place, > rather than build the wrong one and then rebuild a correct one. This is sounding more like a SQL/DB problem and less like a Python one. If you have a field that is being pulled from the database that

Re: grouping a flat list of number by range

2006-06-01 Thread Paddy
I did a little re-arranging of the generator version: def interv3(inlist): tmp = inlist[0] valinc = tmp+1 for val in inlist[1:]: if val != valinc: yield [tmp, valinc]; tmp = val valinc = val+1 yield [tmp, valinc] -- http://mail.python.org/m

Re: struct: type registration?

2006-06-01 Thread John Machin
On 2/06/2006 4:18 AM, Serge Orlov wrote: > Giovanni Bajo wrote: >> John Machin wrote: >>> I am an idiot, so please be gentle with me: I don't understand why you >>> are using struct.pack at all: >> Because I want to be able to parse largest chunks of binary datas with custom >> formatting. Did you

Solved: Tktable, WinXP and ActiveState Python 2.4.3,x

2006-06-01 Thread jerry . levan
[EMAIL PROTECTED] wrote: > Hi, > I have a python app that runs fine on MacOS X and Fedora Core 5. > > This evening I dragged the folder over to my windows partition and > tried to run the rascal. > > The program starts up fine but at the first call to create a Table > object > I get > > Traceback

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Slawomir Nowaczyk
On Thu, 01 Jun 2006 15:12:23 -0700 [EMAIL PROTECTED] wrote: #> I believe that 'is' tests equality of reference, such that #> #> >>> a = range(1,3) #> >>> b = range(1,3) #> >>> a is b #> False #> #> The 'is' operator tells you whether a and b refer to the same object. #> What I've been discussing

Re: grouping a flat list of number by range

2006-06-01 Thread Paddy
[EMAIL PROTECTED] wrote: > hello, > > i'm looking for a way to have a list of number grouped by consecutive > interval, after a search, for example : > > [3, 6, 7, 8, 12, 13, 15] > > => > > [[3, 4], [6,9], [12, 14], [15, 16]] > > (6, not following 3, so 3 => [3:4] ; 7, 8 following 6 so 6, 7, 8 => >

Re: argmax

2006-06-01 Thread Ben Cartwright
David Isaac wrote: > 2. Is this a good argmax (as long as I know the iterable is finite)? > def argmax(iterable): return max(izip( iterable, count() ))[1] Other than the subtle difference that Peter Otten pointed out, that's a good method. However if the iterable is a list, it's cleaner (and more

Re: Tkinter - changing existing Dialog?

2006-06-01 Thread John McMonagle
On Thu, 2006-06-01 at 08:31 -0400, Michael Yanowitz wrote: > Hello: > > >I have a Tkinter GUI Dialog with many buttons and labels and text > widgets. > What I would like to do is, can I: > > 1) Disable/deactivate/hide a button, text widget that is already drawn (and >of course the opposi

Re: losing handles of open files

2006-06-01 Thread Ben Finney
Please don't post non-text message bodies to discussion forums. Message bodies should be plain text. "Anthra Norell" <[EMAIL PROTECTED]> writes: > If a piece of code exits with an exception before it closes an open > file, that file seems to remain locked, which is real pain in the > butt You wi

Re: TSV to HTML

2006-06-01 Thread Brian
Dennis Lee Bieber wrote: > On 1 Jun 2006 03:29:35 -0700, "Brian" <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > Thank you for that response. Your code was very helpful to me. I > > think that actually seeing how it should be done in Python was a lot > > more educational

Re: Replace one element of a tuple (LONG)

2006-06-01 Thread Captain Dondo
BartlebyScrivener wrote: >>>I've looked at various search-and-replace snippets but none that address >>>what I am trying to do > > > I think you need to tell more about what you're trying to do. You say > it's in a database? Is that why you can't just put the whole blob in > your text editor

Re: grouping a flat list of number by range

2006-06-01 Thread Ben Cartwright
[EMAIL PROTECTED] wrote: > i'm looking for a way to have a list of number grouped by consecutive > interval, after a search, for example : > > [3, 6, 7, 8, 12, 13, 15] > > => > > [[3, 4], [6,9], [12, 14], [15, 16]] > > (6, not following 3, so 3 => [3:4] ; 7, 8 following 6 so 6, 7, 8 => > [6:9], and

Re: An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
I believe that 'is' tests equality of reference, such that >>> a = range(1,3) >>> b = range(1,3) >>> a is b False The 'is' operator tells you whether a and b refer to the same object. What I've been discussing is whether == should test for "structural" equality so that a and b remain equivalent u

Re: grouping a flat list of number by range

2006-06-01 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >hello, > >i'm looking for a way to have a list of number grouped by consecutive >interval, after a search, for example : > >[3, 6, 7, 8, 12, 13, 15] > >=> > >[[3, 4], [6,9], [12, 14], [15, 16]] > >(6, not following 3, so 3 => [3:4] ; 7, 8

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Slawomir Nowaczyk
On Thu, 01 Jun 2006 13:40:34 -0700 [EMAIL PROTECTED] wrote: #> Scott David Daniels wrote: #> > Would you say that envelope containing five $100 bills is equal to #> > an envelope containing five $100 bills with different serial numbers? #> Yes (unless I was testing the assertion that the second e

Re: urllib2 and HTTP 302

2006-06-01 Thread John J. Lee
Laszlo Nagy <[EMAIL PROTECTED]> writes: [...] > how can I return the redirection URL? > I tried to get this information from the exception but I could not. Is > it possible to read it from the openerdirector? > Any suggestions? > > > try: >self.post_multipart( >

Re: Finding a lost PYTHONPATH with find

2006-06-01 Thread John J. Lee
Edward Elliott <[EMAIL PROTECTED]> writes: > John J. Lee wrote: > > > find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \; > > > > > > The minus in '-100k' (meaning "less than 100k") seems to be > > undocumented, at least on my system. > > It should be standard in linux

Re: An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
Truthfully, I wouldn't mind it at all. In Python, I frequently write things like i == int(f) or vice versa just to avoid subtle bugs that sometimes creep in when later modifications to code change the original assumptions. When working in C, I always set the compiler for maximum warnings and d

Re: Using print instead of file.write(str)

2006-06-01 Thread A.M
Yes, it saved my time big time. Thank you Bruno. I use the print >>>file to generate HTML files. print is very flexible and nice. The dictionary formatting that Brunto said is awesome! Thanks again, Alan "Jon Clements" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Di

Re: Replace one element of a tuple

2006-06-01 Thread BartlebyScrivener
>> I've looked at various search-and-replace snippets but none that address >> what I am trying to do I think you need to tell more about what you're trying to do. You say it's in a database? Is that why you can't just put the whole blob in your text editor and do search-and-replace? And is t

Re: grouping a flat list of number by range

2006-06-01 Thread Peter Otten
[EMAIL PROTECTED] wrote: > i'm looking for a way to have a list of number grouped by consecutive > interval, after a search, for example : > > [3, 6, 7, 8, 12, 13, 15] > > => > > [[3, 4], [6,9], [12, 14], [15, 16]] > > (6, not following 3, so 3 => [3:4] ; 7, 8 following 6 so 6, 7, 8 => > [6:9]

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Maric Michaud
Le Jeudi 01 Juin 2006 18:00, [EMAIL PROTECTED] a écrit : > Perhaps the most fundamental notion is mathematics is that the left and > right sides of an equation remain identical after any operation applied > to both sides. IMHO, you are not aware that the '=' symbol of mathematics exists in python,

Re: Using print instead of file.write(str)

2006-06-01 Thread Jon Clements
I meant 'trailing': not leading. mea culpa. Jon. Jon Clements wrote: > Didn't know of the >> syntax: lovely to know about it Bruno - thank > you. > > To the OP - I find the print statement useful for something like: > print 'this','is','a','test' > >>> 'this is a test' > (with implicit newline

Re: struct: type registration?

2006-06-01 Thread John Machin
On 2/06/2006 3:44 AM, Giovanni Bajo wrote: > John Machin wrote: > >>> Looks like you totally misread my message. >> Not at all. >> >> Your function: >> >> def mystring_pack(s): >> if len(s) > 20: >> raise ValueError, "a mystring can be at max 20 chars" >> s = (s + "\0"*20)[:20]

Re: Add file to zip, or replace file in zip

2006-06-01 Thread Chris Lambacher
Skip over the file in question when you first are zipping the directory. Unfortunately you cannot replace or remove a file from a zip without unzipping and rezipping all the contents. -Chris On Wed, May 31, 2006 at 03:10:53PM +0800, majj81 wrote: >hi: > Good afternoon. > Has this pr

Re: Replace one element of a tuple

2006-06-01 Thread [EMAIL PROTECTED]
Captain Dondo wrote: > I have an array(?) (sorry, I'm new* to python so I'm probably mangling > the terminology) that looks like this: > > [((1028L, datetime.datetime(2006, 5, 30, 7, 0), datetime.datetime(2006, > 5, 30, 7, 30), 'Arthur', 'Prunella Sees the Light; Return of the > Snowball', 'Prunel

Re: Using print instead of file.write(str)

2006-06-01 Thread Jon Clements
Didn't know of the >> syntax: lovely to know about it Bruno - thank you. To the OP - I find the print statement useful for something like: print 'this','is','a','test' >>> 'this is a test' (with implicit newline and implicit spacing between parameters) If you want more control (more flexibility,

Re: integer to binary...

2006-06-01 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > does anyone know a module or something to convert numbers like integer > to binary format ? > > for example I want to convert number 7 to 0111 so I can make some > bitwise operations... > > Thanks Use the gmpy module. >>> import gmpy >>> a = 14 >>> b = 7 >>> c = 8 >>>

grouping a flat list of number by range

2006-06-01 Thread joh12005
hello, i'm looking for a way to have a list of number grouped by consecutive interval, after a search, for example : [3, 6, 7, 8, 12, 13, 15] => [[3, 4], [6,9], [12, 14], [15, 16]] (6, not following 3, so 3 => [3:4] ; 7, 8 following 6 so 6, 7, 8 => [6:9], and so on) i was able to to it withou

Re: WinPops

2006-06-01 Thread Peter Gsellmann
Roger Upole wrote: > > "Hari Sekhon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hi, >> Is there a way of sending winpops (Windows Pop-Up / Net Send messages) >> in python? >> >> Perhaps some library or something that I can use under both Windows and >> Linux? >> >> Hari

Replace one element of a tuple

2006-06-01 Thread Captain Dondo
I have an array(?) (sorry, I'm new* to python so I'm probably mangling the terminology) that looks like this: [((1028L, datetime.datetime(2006, 5, 30, 7, 0), datetime.datetime(2006, 5, 30, 7, 30), 'Arthur', 'Prunella Sees the Light; Return of the Snowball', 'Prunella prepares for a sleepover wi

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread A.M
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > A.M wrote: > >> This is my 1st day that I am seriously diving into Python and I have to >> finish this application by the end of today. Maybe it wasn't a good idea >> to choose the language that I don't know when I ha

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > With all due respect to your well-deserved standing in the Python > community, I'm not convinced that equality shouldn't imply invariance > under identical operations. Doo you really want 2 == 2.0 to be False? -- Erik Max Francis && [EMAIL PROTECTED] && http

Re: Tkinter: select multiple entries in Listbox widget?

2006-06-01 Thread Bernard Lebel
Oh, thanks a lot Rob. Bernard On 6/1/06, Rob Williscroft <[EMAIL PROTECTED]> wrote: > Bernard Lebel wrote in news:mailman.6413.1149178158.27775.python- > [EMAIL PROTECTED] in comp.lang.python: > > > Hello, > > > > Is there an option or a way to allow the selection of multiple entries > > in th

Re: An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
Yes (unless I was testing the assertion that the second envelope did not contain counterfeits of the first) Scott David Daniels wrote: > Would you say that envelope containing five $100 bills is equal to > an envelope containing five $100 bills with different serial numbers? -- http://mail.pytho

Re: how to print newline in xml?

2006-06-01 Thread [EMAIL PROTECTED]
I use Python/XML packages are xml.dom.minidom and xml.dom.ext (second just for PrettyPrint) -- http://mail.python.org/mailman/listinfo/python-list

if not CGI:

2006-06-01 Thread Max
I've never done anything on the web. I mean, never developed anything. (I've got accounts on dA and wikipedia and half-a-dozen other things; I know HTML and enough JavaScript to hack away at it when friends need help). Mostly because I've never had anything worth doing: I've written a set of py

Re: An oddity in list comparison and element assignment

2006-06-01 Thread michael . f . ellis
Considering the number of new programmers who get bit by automatic coercion, I wish Dennis Ritchie had made some different choices when he designed C. But then I doubt he ever dreamed it would become so wildly successful. Being a curmudgeon purist I'd actually prefer it if Python raised a TypeErr

Re: New to Python: Do we have the concept of Hash in Python?

2006-06-01 Thread A.M
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > A.M wrote: > >> This is my 1st day that I am seriously diving into Python and I have to >> finish this application by the end of today. Maybe it wasn't a good idea >> to choose the language that I don't know when I h

Re: Best Python Editor

2006-06-01 Thread Jarek Zgoda
Fredrik Lundh napisał(a): >>Can anyone tell me a good python editor/IDE? > > vim! jEdit! >>It would be great if you can provide the download link also. > > google it! google it! :D(I love these Vim <-> Emacs disputes) -- Jarek Zgoda http://jpa.berlios.de/ -- http:/

Re: Using print instead of file.write(str)

2006-06-01 Thread Bruno Desthuilliers
A.M a écrit : > Hi, > > > I found print much more flexible that write method. Can I use print instead > of file.write method? > f = open("/path/to/file") print >> f, "this is my %s message" % "first" f.close() To print to stderr: import sys print >> sys.stderr, "oops" FWIW, you and use stri

Re: How to format datetime values

2006-06-01 Thread A.M
"BartlebyScrivener" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Are you trying to get banned, or what? > > It's the equivalent of me asking you: > > Hey, does Ruby have anything like dictionaries and will you teach me > about strings? Oh, and what's an object? > > Go read the b

  1   2   3   >