Re: Python "why" questions

2010-08-15 Thread Bob Martin
in 639663 20100815 120123 Lawrence D'Oliveiro wrote: >In message , Ian Kelly >wrote: > >> The ability to change the minimum index is evil. > >Pascal allowed you to do that. And nobody ever characterized Pascal as >“evil”. Not for that reason, anyway... Why do yo

Re: Python XML and tables using math

2010-08-15 Thread Stefan Behnel
flebber, 16.08.2010 05:30: I am looking at a project that will import and modify an XML file and then export it to a table. Currently a flat file table system should be fine. I want to export the modified data to the table and then perform a handful of maths(largely simple statistical functions)

Re: Pop return from stack?

2010-08-15 Thread Carl Banks
On Aug 15, 6:43 pm, bvdp wrote: > On Aug 15, 12:52 pm, John Nagle wrote: > > > > > On 8/14/2010 4:05 PM, bvdp wrote: > > > > Assuming I have a module 'foo.py' with something like this: > > > > def error(s): > > >      print "Error", s > > >      sys.exit(1) > > > > def func(s): > > >      ... do

Re: 2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread Jemy
http://effbot.org/tkinterbook/label.htm Hope this url will be of some help to you all. Regards Jemy -- http://mail.python.org/mailman/listinfo/python-list

Re: 2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread Jemy
I attached the source file On Mon, Aug 16, 2010 at 5:17 AM, Jemy wrote: > > > On Mon, Aug 16, 2010 at 5:13 AM, 金鑫鑫 wrote: > >> Hi Man, >> I have done that according to your requirements >> Here is the code >> {code} >> >>> #!/usr/bin/python >>> >>> import Tkinter >>> >>> import threading >>> >

Re: 2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread Jemy
On Mon, Aug 16, 2010 at 5:13 AM, 金鑫鑫 wrote: > Hi Man, > I have done that according to your requirements > Here is the code > {code} > >> #!/usr/bin/python >> >> import Tkinter >> >> import threading >> >> >>> root=Tkinter.Tk() >> >> root.geometry("100x100") >> >> v=Tkinter.StringVar() >> >> labe

Re: 2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread 金鑫鑫
Hi Man, I have done that according to your requirements Here is the code {code} > #!/usr/bin/python > > import Tkinter > > import threading > > >> root=Tkinter.Tk() > > root.geometry("100x100") > > v=Tkinter.StringVar() > > label=Tkinter.Label(root,textvariable=v,fg="red") > > label.pack(fill=Tkin

Re: 2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread ChrisChia
On Aug 16, 4:17 am, Terry Reedy wrote: > On 8/15/2010 10:22 AM, ChrisChia wrote: > > > Hi all, > > i am trying to do a GUI with Tkinter package, but i am stuck no matter > > what... > > The problem right now is that my GUI has a label= 'A' (where 'A' is > > the text on display) > > > i wish to run

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message <8crg0effb...@mid.individual.net>, Gregory Ewing wrote: > For example, the constant term of a polynomial is usually called term 0, > not term 1. That is not some kind of ordinal numbering of the terms, that is the power of the variable involved. And polynomials can have negative powe

Re: Pop return from stack?

2010-08-15 Thread Carey Tilden
On Sun, Aug 15, 2010 at 6:43 PM, bvdp wrote: > Not to belabor the point .. but "func" is not a standard lib module. > It's part of a much larger application ... and in that application it > makes perfect sense to terminate the application if it encounters an > error. I fail to see the problem wit

Python XML and tables using math

2010-08-15 Thread flebber
I am looking at a project that will import and modify an XML file and then export it to a table. Currently a flat file table system should be fine. I want to export the modified data to the table and then perform a handful of maths(largely simple statistical functions) to the data and then print o

Re: Tkinter/threading issue

2010-08-15 Thread Jerrad Genson
Well, I figured it out. Thanks anyway for your help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pop return from stack?

2010-08-15 Thread bvdp
On Aug 15, 12:52 pm, John Nagle wrote: > On 8/14/2010 4:05 PM, bvdp wrote: > > > Assuming I have a module 'foo.py' with something like this: > > > def error(s): > >      print "Error", s > >      sys.exit(1) > > > def func(s): > >      ... do some processing > >      ... call error() if bad .. go

Re: Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-15 Thread MRAB
Alex Willmer wrote: On Aug 16, 1:07 am, Steven D'Aprano wrote: You're passing re.IGNORECASE (which happens to equal 2) as a count argument, not as a flag. Try this instead: re.sub(r"python\d\d" + '(?i)', "Python27", t) 'Python27' Basically right, but in-line flags must be placed at the sta

Re: Python "why" questions

2010-08-15 Thread Roy Smith
In article <8crg0effb...@mid.individual.net>, Gregory Ewing wrote: > Not always -- mathematicians use whatever starting index is > most convenient for the problem at hand. Which may be 0, 1, or something else. There are plenty of situations, for example, where you might want to use both posit

Re: Python "why" questions

2010-08-15 Thread Gregory Ewing
On Aug 7, 2010, at 9:14 PM, John Nagle wrote: The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That reflects standard practice in mathematics. Not always -- mathematicians use whatever starting index is most convenient for

Re: Python "why" questions

2010-08-15 Thread Gregory Ewing
Roald de Vries wrote: On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: Which somewhat defeats the point of trying to make them look the same, don’t you think? How are they not the same? One way to see that they're not *exactly* the same is the fact that sizeof("python rocks") i

Re: Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-15 Thread Alex Willmer
On Aug 16, 1:07 am, Steven D'Aprano wrote: > You're passing re.IGNORECASE (which happens to equal 2) as a count > argument, not as a flag. Try this instead: > > >>> re.sub(r"python\d\d" + '(?i)', "Python27", t) > 'Python27' Basically right, but in-line flags must be placed at the start of a patte

Re: Python "why" questions

2010-08-15 Thread Gregory Ewing
Ian Kelly wrote: On Fri, Aug 13, 2010 at 11:53 AM, Martin Gregorie wrote: real sample[-500:750]; Ugh, no. The ability to change the minimum index is evil. Not always; it can have its uses, particularly when you're using the array as a mapping rather than a collection. Pascal had

Re: Opposite of split

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 19:58:54 -0400, Roy Smith wrote: > Actually, > there is (at least) one situation where this produces the correct > result, can you find it? When myList is empty, it correctly gives the empty string. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 16:45:49 -0700, Christopher wrote: > I have the following problem: > t="Python26" import re re.sub(r"python\d\d", "Python27", t) > 'Python26' re.sub(r"python\d\d", "Python27", t, re.IGNORECASE) > 'Python26' re.sub(r"Python\d\d", "Python27", t, re.IGNORE

Re: Opposite of split

2010-08-15 Thread D'Arcy J.M. Cain
On 15 Aug 2010 23:33:10 GMT Steven D'Aprano wrote: > Under what possible circumstances would you prefer this code to the built- > in str.join method? I assumed that it was a trap for someone asking for us to do his homework. I also thought that it was a waste of time because I knew that twenty p

Re: Opposite of split

2010-08-15 Thread Roy Smith
In article <4c687936$0$11100$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 15 Aug 2010 12:10:10 -0700, Steven Howe wrote: > > >> Strings have a join method for this: > >> '\t'.join(someList) > >> > >> Gary Herron > > or maybe: > > - >

Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-15 Thread Christopher
I have the following problem: Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> t="Python26" >>> import re >>> re.sub(r"python\d\d", "Python27", t) 'Python26' >>> re.sub(r"python\d\d", "Pyth

python strings and {} in Tkinter entry widgets

2010-08-15 Thread Chris Hare
I have some code that pulls a value from a database. In this case, it is three space delimited words. When I display the value in a Tkinter.Entry widget, the text has curly braces around it, even when there are none in the surrounding the text in the database. Is this normal, and how do I pr

Re: Opposite of split

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 12:10:10 -0700, Steven Howe wrote: >> Strings have a join method for this: >> '\t'.join(someList) >> >> Gary Herron > or maybe: > - > res = "" > for item in myList: > res = "%s\t%s" % ( res, item ) Under what possible circums

Re: execfile() and locals()

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 23:21:51 +0200, fons wrote: > Hello all, > > The documentation on execfile() and locals() makes it clear that code > executed from execfile() can not modify local variables in the function > from wich execfile() was called. Two questions about this: > > 1. Is there some way t

Re: execfile() and locals()

2010-08-15 Thread Thomas Jollans
On Sunday 15 August 2010, it occurred to f...@kokkinizita.net to exclaim: > Hello all, > > The documentation on execfile() and locals() makes it clear that code > executed from execfile() can not modify local variables in the function > from wich execfile() was called. Two questions about this: >

RE: NZEC what is it?

2010-08-15 Thread Mikael B
> From: ian.g.ke...@gmail.com > Date: Sun, 15 Aug 2010 17:39:57 -0400 > Subject: Re: NZEC what is it? > To: python-list@python.org > > On Sun, Aug 15, 2010 at 12:56 PM, Mikael B wrote: > > Hi > > I use, among other things, a site, http://www.codechef.com to learn > > python. > > I don't kn

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Ian Kelly
On Sun, Aug 15, 2010 at 4:36 PM, Baba wrote: > Hi Mel, > > indeed i thought of generalising the theorem as follows: > If it is possible to buy n, n+1,…, n+(x-1) sets of McNuggets, for some > x, then it is possible to buy any number of McNuggets >= x, given that > McNuggets come in x, y and z packs

Re: NZEC what is it?

2010-08-15 Thread Ian Kelly
On Sun, Aug 15, 2010 at 12:56 PM, Mikael B wrote: > Hi >  I use, among other things,  a site,  http://www.codechef.com  to learn > python. > I don't know what platform they use. I use  linux. > > When I submit this little piece of  code to them: > > import sys > import math > > #main > > s=sys.std

execfile() and locals()

2010-08-15 Thread fons
Hello all, The documentation on execfile() and locals() makes it clear that code executed from execfile() can not modify local variables in the function from wich execfile() was called. Two questions about this: 1. Is there some way to circumvent this limitation (apart from explicitly copying var

Re: segfault with small pyqt script

2010-08-15 Thread Hans-Peter Jansen
On Thursday 12 August 2010, 01:07:25 Gelonida wrote: > Hi Guys, > I'm desperate. I'm having a real application, which fails rather often > when finishing it. I'm not sure, whether any serious problem could be > hidden behind it > > The script is a pyqt script, which segfaults most of the time on my

Re: Tkinter/threading issue

2010-08-15 Thread Jerrad Genson
def check_message(self, spawn=True): '''Method for pulling message from server process.''' if spawn: self.pid2 = os.fork() if self.pid2 == 0: if verbose: print('message checker initialized') # repeat message check forever while True:

Re: Tkinter/threading issue

2010-08-15 Thread Jerrad Genson
class MessageServer: '''Creates a message server object that listens for textual information and sends it back to the main program. Intended to be spawned as a separate process. ''' def __init__(self, port_number, server_send, server_receive): '''@param server_

Re: Tkinter/threading issue

2010-08-15 Thread Jerrad Genson
Thank you for the reply. When I said "TCP/IP" protocol, what I meant was this: http://en.wikipedia.org/wiki/Internet_Protocol_Suite. The reason the server is in a separate process is because it needs to continually be listening for network packets, which would disrupt the GUI. In any case, that pa

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
Hi Mel, indeed i thought of generalising the theorem as follows: If it is possible to buy n, n+1,…, n+(x-1) sets of McNuggets, for some x, then it is possible to buy any number of McNuggets >= x, given that McNuggets come in x, y and z packs. so with diophantine_nuggets(7,10,21) i would need 7 pa

Re: Tkinter/threading issue

2010-08-15 Thread Thomas Jollans
On Sunday 15 August 2010, it occurred to Jerrad Genson to exclaim: > Hello, > > I'm learning Tkinter, and I have an issue that I'd appreciate help > with. I have a program that initializes a GUI (I'll call this the "GUI > process"), then spawns another process that listens on a network via > the T

Re: Tkinter/threading issue

2010-08-15 Thread Jerrad Genson
I should also mention that I'm running Ubuntu 10.04 and Python 2.6.5. -- http://mail.python.org/mailman/listinfo/python-list

Tkinter/threading issue

2010-08-15 Thread Jerrad Genson
Hello, I'm learning Tkinter, and I have an issue that I'd appreciate help with. I have a program that initializes a GUI (I'll call this the "GUI process"), then spawns another process that listens on a network via the TCP/IP protocol for incoming strings (I'll call this the "server process"). Ever

Re: Pop return from stack?

2010-08-15 Thread John Nagle
On 8/14/2010 4:05 PM, bvdp wrote: Assuming I have a module 'foo.py' with something like this: def error(s): print "Error", s sys.exit(1) def func(s): ... do some processing ... call error() if bad .. go to system exit. ... more processing Fix "func". That's terri

Re: OpenCV_Problem

2010-08-15 Thread arihant nahata
Hi, There is no file named _cv.dll file in the directory that you mentioned -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Mel
Baba wrote: > Hi All, > > @Emile tnx for spotting the mistake. Should have seen it myself. > > @John & Ian i had a look around but couldn't find a general version of > below theorem > If it is possible to buy x, x+1,…, x+5 sets of McNuggets, for some x, > then it is possible to buy any number

Re: Opposite of split

2010-08-15 Thread Steven Howe
On 08/15/2010 11:35 AM, Gary Herron wrote: On 08/15/2010 11:24 AM, Alex van der Spek wrote: Looking for a method that does the opposite of 'split', i.e. elements in a list are automatically concatenated with a user selectable spacer in between e.g. '\t'. This is to prepare lines to be written

Re: Simple Python Sandbox

2010-08-15 Thread jacek2v
On Aug 14, 1:37 am, Stephen Hansen wrote: > Can you think of a way out of such a sandbox? A way to access disallowed > stuff, not a way to DOS. Hi, I have strange idea :): use Google Apps. You'll need prepare some interfaces for your apps (for example via WebServices) Maybe it is wrong way, maybe

Re: OpenCV_Problem

2010-08-15 Thread arihant nahata
Hi, There is no file named _cv.dll file in the directory that you mentioned -- http://mail.python.org/mailman/listinfo/python-list

RE: NZEC what is it?

2010-08-15 Thread Mikael B
From: mba...@live.se To: pyt...@mrabarnett.plus.com Subject: RE: NZEC what is it? Date: Sun, 15 Aug 2010 19:58:44 +0200 > Date: Sun, 15 Aug 2010 18:22:54 +0100 > From: pyt...@mrabarnett.plus.com > To: python-list@python.org > Subject: Re: NZEC what is it? > > Mikael B wrote: > > Hi

Programmers (esp. Windows) needed for SpamBayes

2010-08-15 Thread skip
If you have some time to devote to a popular open source Python project, we can use some development help with SpamBayes, particularly on Windows and with Outlook 2010: http://wiki.python.org/moin/VolunteerOpportunities#SpamBayesProject Thanks, -- Skip Montanaro - s...@pobox.com - http://w

Re: Opposite of split

2010-08-15 Thread Gary Herron
On 08/15/2010 11:24 AM, Alex van der Spek wrote: Looking for a method that does the opposite of 'split', i.e. elements in a list are automatically concatenated with a user selectable spacer in between e.g. '\t'. This is to prepare lines to be written to a sequential file by 'write'. All hints

Re: Opposite of split

2010-08-15 Thread Wieland Hoffmann
On 15.08.2010 20:24, Alex van der Spek wrote: > Looking for a method that does the opposite of 'split', i.e. elements in > a list are automatically concatenated with a user selectable spacer in > between e.g. '\t'. >>> " ".join(["i","am","a","list"]) 'i am a list' Wieland -- http://mail.python.

Opposite of split

2010-08-15 Thread Alex van der Spek
Looking for a method that does the opposite of 'split', i.e. elements in a list are automatically concatenated with a user selectable spacer in between e.g. '\t'. This is to prepare lines to be written to a sequential file by 'write'. All hints welcome. Regards, Alex van der Spek -- http:/

Re: 2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread Terry Reedy
On 8/15/2010 10:22 AM, ChrisChia wrote: Hi all, i am trying to do a GUI with Tkinter package, but i am stuck no matter what... The problem right now is that my GUI has a label= 'A' (where 'A' is the text on display) i wish to run a program with 2 threads... one for my GUI and the other for the t

Re: math symbols in unicode (grouped by purpose)

2010-08-15 Thread Xah Lee
hi kenny! Xah Lee wrote: > some collection of math symbols in unicode. > • Math Symbols in Unicode >    http://xahlee.org/comp/unicode_math_operators.html Kenneth Tilton wrote: > I am surprised you do not include the numeric character codes. i thought about it, but the page would get unwieldy. T

Re: NZEC what is it?

2010-08-15 Thread MRAB
Mikael B wrote: Hi I use, among other things, a site, http://www.codechef.com to learn python. I don't know what platform they use. I use linux. When I submit this little piece of code to them: import sys import math #main s=sys.stdin.read() int_list=s.split() for a in int_list[1:]:

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
Hi All, @Emile tnx for spotting the mistake. Should have seen it myself. @John & Ian i had a look around but couldn't find a general version of below theorem If it is possible to buy x, x+1,…, x+5 sets of McNuggets, for some x, then it is possible to buy any number of McNuggets >= x, given that M

NZEC what is it?

2010-08-15 Thread Mikael B
Hi I use, among other things, a site, http://www.codechef.com to learn python. I don't know what platform they use. I use linux. When I submit this little piece of code to them: import sys import math #main s=sys.stdin.read() int_list=s.split() for a in int_list[1:]: print mat

adding a "windows" item to a menu bar dynamically

2010-08-15 Thread Chris Hare
I want to add a "Windows" menu item to my menu bar, so when another Toplevel window is opened, I can add that to the menu bar in case the user accidentally clicks on a different window and moves the Toplevel under something else. Then when the window is closed, remove the window from the menu

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread John Posner
On 8/15/2010 11:38 AM, Baba wrote: In addition to the points that Emile and Ian made ... def diophantine_nuggets(x,y,z): cbc=0 #cbc=can_buy counter packages =[x,y,z] You can take advantage of a nifty "syntax convenience feature" here. Instead of loading all of the function's argumen

Re: Python "why" questions

2010-08-15 Thread John Nagle
On 8/15/2010 4:00 AM, Lawrence D'Oliveiro wrote: In message, Thomas Jollans wrote: "Where it all started" is that 0-based indexing gives languages like C a very nice property: a[i] and *(a+i) are equivalent in C. From a language design viewpoint, I think that's quite a strong argument. It wou

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Ian Kelly
On Sun, Aug 15, 2010 at 9:58 AM, Emile van Sebille wrote: > On 8/15/2010 8:44 AM Baba said... >> >> Hi John, >> >> Thanks for your submission! I've improved a lot and everone's help so >> far has been thrilling and is very good for my self-study >> motivation :) >> >> ok so i think i'm clear on ho

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Emile van Sebille
On 8/15/2010 8:44 AM Baba said... Hi John, Thanks for your submission! I've improved a lot and everone's help so far has been thrilling and is very good for my self-study motivation :) ok so i think i'm clear on how to approach this problem and on how to write basic but clean Python code to sol

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
Hi John, Thanks for your submission! I've improved a lot and everone's help so far has been thrilling and is very good for my self-study motivation :) ok so i think i'm clear on how to approach this problem and on how to write basic but clean Python code to solve it. The next step is to generali

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-15 Thread Baba
Hi John, Thanks for your submission! I've improved a lot and everone's help so far has been thrilling amd is very good for my self-study motivation :) ok so i think i'm clear on how to approach this problem and on how to write basic but clean Python code to solve it. The next step is to generali

Re: shelf-like list?

2010-08-15 Thread Emile van Sebille
On 8/15/2010 3:58 AM kj said... In "Martin v. Loewis" writes: Does anyone know of such a module? ZODB supports persistent lists. Thanks; I'll check it out. I wouldn't expect a low memory footprint however. :) Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Problem but tough for me if i want it in linear time

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 05:47:04 -0700, ChrisChia wrote: > dataList = [a, b, c, ...] > where a, b, c are objects of a Class X. In Class X, it contains > self.name and self.number > > If i wish to test whether a number (let's say 100) appears in one of the > object, and return that object, > is that o

Re: math symbols in unicode (grouped by purpose)

2010-08-15 Thread Kenneth Tilton
On 8/13/2010 5:18 PM, Xah Lee wrote: some collection of math symbols in unicode. • Math Symbols in Unicode http://xahlee.org/comp/unicode_math_operators.html I am surprised you do not include the numeric character codes. kt • Arrows in Unicode http://xahlee.org/comp/unicode_arrows.ht

Mecca direct transfer 24 hours

2010-08-15 Thread nais-saudi
Mecca direct transfer 24 hours You will not believe your eyes what you feel that a direct http://ar.justin.tv/bidayatv#/w/312906784/30 Fairy scenes The sections that cried and asked YouTube viewers translation: http://www.youtube.com/v/IFq9cjtrWlQ&rel=0 http://www.youtube.com/v/y2BN73Q-AJw&

2 threads; 1 more Tkinter and 1 more terminal. problem

2010-08-15 Thread ChrisChia
Hi all, i am trying to do a GUI with Tkinter package, but i am stuck no matter what... The problem right now is that my GUI has a label= 'A' (where 'A' is the text on display) i wish to run a program with 2 threads... one for my GUI and the other for the terminal where the terminal will keep liste

Re: Simple Problem but tough for me if i want it in linear time

2010-08-15 Thread MRAB
ChrisChia wrote: dataList = [a, b, c, ...] where a, b, c are objects of a Class X. In Class X, it contains self.name and self.number If i wish to test whether a number (let's say 100) appears in one of the object, and return that object, is that only fast way of solving this problem without iter

Re: Simple Problem but tough for me if i want it in linear time

2010-08-15 Thread Peter Otten
ChrisChia wrote: > dataList = [a, b, c, ...] > where a, b, c are objects of a Class X. > In Class X, it contains self.name and self.number > > If i wish to test whether a number (let's say 100) appears in one of > the object, and return that object, > is that only fast way of solving this problem

Re: OpenCV_Problem

2010-08-15 Thread Rami Chowdhury
Hi Arihant, Please make sure your response goes out to the list -- I suggest using 'reply all' rather than 'reply'. Also, please make sure the previous conversation is included in your email -- otherwise people might not understand your problem and be able to help. On Sunday 15 August 2010 12

Re: Python "why" questions

2010-08-15 Thread Dave Angel
Roald de Vries wrote: On Aug 15, 2010, at 2:16 PM, geremy condra wrote: On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries wrote: On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: It would be if pointers and arrays were the same thing in C. Only they’re not, quite. Which somewhat defeats

Simple Problem but tough for me if i want it in linear time

2010-08-15 Thread ChrisChia
dataList = [a, b, c, ...] where a, b, c are objects of a Class X. In Class X, it contains self.name and self.number If i wish to test whether a number (let's say 100) appears in one of the object, and return that object, is that only fast way of solving this problem without iterating through every

Re: shelf-like list?

2010-08-15 Thread Dave Angel
kj wrote: self.save() Even though it is saved periodically to disk, it looks like the whole list remains in memory all the time? (If so, it's not what I'm looking for; the whole point of saving stuff to disk is to keep the list's memory footprint low.) ~K It sounds like

Re: Pop return from stack?

2010-08-15 Thread Dave Angel
Steven D'Aprano wrote: On Sat, 14 Aug 2010 16:05:05 -0700, bvdp wrote: def error(s): print "Error", s sys.exit(1) This general technique is called "monkey patching". You can either manually exit from your own error handler: def myerror(s): print "new error message

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
On Aug 15, 2010, at 2:16 PM, geremy condra wrote: On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries wrote: On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: It would be if pointers and arrays were the same thing in C. Only they’re not, quite. Which somewhat defeats the point of trying

Re: Python "why" questions

2010-08-15 Thread geremy condra
On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries wrote: > On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: >> >> It would be if pointers and arrays were the same thing in C. Only they’re >> not, quite. Which somewhat defeats the point of trying to make them look >> the >> same, don’t you thi

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
On Aug 7, 2010, at 9:14 PM, John Nagle wrote: FORTRAN, MATLAB, and Octave all use 1-based subscripts. The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That reflects standard practice in mathematics. True, but that somethi

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: It would be if pointers and arrays were the same thing in C. Only they’re not, quite. Which somewhat defeats the point of trying to make them look the same, don’t you think? How are they not the same? The code snippet (in C/C++) below

Re: writing \feff at the begining of a file

2010-08-15 Thread Peter Billam
On 2010-08-14, Martin v. Loewis wrote: >> Is there a standard way to autodetect the encoding of a text file? > Use the chardet module: > http://chardet.feedparser.org/ Very timely: the python-chardet package just seems to have appeared on debian squeeze :-) After my latest "aptitude safe-upgrad

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message , Ian Kelly wrote: > The ability to change the minimum index is evil. Pascal allowed you to do that. And nobody ever characterized Pascal as “evil”. Not for that reason, anyway... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message , Thomas Jollans wrote: > "Where it all started" is that 0-based indexing gives languages like C a > very nice property: a[i] and *(a+i) are equivalent in C. From a language > design viewpoint, I think that's quite a strong argument. It would be if pointers and arrays were the same th

Re: shelf-like list?

2010-08-15 Thread kj
In "Martin v. Loewis" writes: >> Does anyone know of such a module? >ZODB supports persistent lists. Thanks; I'll check it out. ~K -- http://mail.python.org/mailman/listinfo/python-list

Re: shelf-like list?

2010-08-15 Thread kj
In Chris Rebert writes: >On Sat, Aug 14, 2010 at 5:13 PM, kj wrote: >> In Ra= >ymond Hettinger writes: >>>On Aug 12, 1:37=3DA0pm, Thomas Jollans wrote: On Tuesday 10 August 2010, it occurred to kj to exclaim: > I'm looking for a module that implements "persistent lists": obje

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message <4c5db0ae$0$1641$742ec...@news.sonic.net>, John Nagle wrote: > The languages which have real multidimensional arrays, rather > than arrays of arrays, tend to use 1-based subscripts. That > reflects standard practice in mathematics. Actually I’d go one better, and say that the lang

Re: Simple Python Sandbox

2010-08-15 Thread Lawrence D'Oliveiro
In message , Stephen Hansen wrote: > On 8/14/10 2:25 PM, Cameron Simpson wrote: > >> Ok, what about this: run the untrusted code in a separate process, >> if necessary running as a user with different privileges. > > Way too much overhead by a really significant margin: I need to do many, > many

Re: Why is python not written in C++ ?

2010-08-15 Thread Lawrence D'Oliveiro
In message , Aahz wrote: > Heck, I learned Ada as a sixteen-year-old knowing only BASIC and Pascal. Not so surprising, considering Ada was consciously modelled on Pascal. -- http://mail.python.org/mailman/listinfo/python-list

MOVIES SONGS FITNESS FRIENDSHIPS AND MORE

2010-08-15 Thread p.mahalakshmi maha
new movies new songs new fitness tips new friendships new actress MMS new EXCLUSIVE and MORE FREE www.123maza.com/25/shirt156/ www.slim.com/go/g1246010/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Deditor -- pythonic text-editor

2010-08-15 Thread Kruptein
I've noticed that there were a lot of downloads since I posted this topic, but I don't get any response from anyone so I actually still don't know whether it is good, bad, ugly, pretty, easy to use,... So please help me! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: shelf-like list?

2010-08-15 Thread Martin v. Loewis
> Does anyone know of such a module? ZODB supports persistent lists. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

[ANN]VTD-XML 2.9

2010-08-15 Thread dontcare
VTD-XML 2.9, the next generation XML Processing API for SOA and Cloud computing, has been released. Please visit https://sourceforge.net/projects/vtd-xml/files/ to download the latest version. * Strict Conformance #VTD-XML now fully conforms to XML namespace 1.0 spec * Performance Impr