Re: How can I obtain the exception object on a generlized except statement?

2007-06-11 Thread Duncan Booth
Chris Allen <[EMAIL PROTECTED]> wrote: > I am confused on one aspect of exception handling. If you specify the > exception object type to match in an except statement it is possible > to also obtain the exception object itself, but I can't figure out how > to get the exception object when I don't

Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

2007-06-11 Thread Twisted
On Jun 11, 2:42 am, Joachim Durchholz <[EMAIL PROTECTED]> wrote: > It is possible to write maintainable Perl. Interesting (spoken in the tone of someone hearing about a purported sighting of Bigfoot, or maybe a UFO). Still, extraordinary claims require extraordinary evidence. (And no, a fuzzy pic

Re: Why does one regex routine work and not the other one?

2007-06-11 Thread Peter Otten
TtfnJohn wrote: > I have two small scripts that while on the surface should both work > the problem is they don't. > > Here's the first one: > import re > > testString = 'Thap,fpvi,[EMAIL PROTECTED]:[EMAIL PROTECTED] > dialin.net:[EMAIL PROTECTED]::' > > reobj = re.compile(r"(.*),(.*),(.*):

Re: Python optimization (was Python's "only one way to do it" philosophy isn't good?)

2007-06-11 Thread Diez B. Roggisch
>It's hard to optimize Python code well without global analysis. > The problem is that you have to make sure that a long list of "wierd > things", like modifying code or variables via getattr/setattr, aren't > happening before doing significant optimizations. Without that, > you're doomed to a

Working with dictionary like strings

2007-06-11 Thread Mr SZ
hello all, I'm using the urllib module to fetch pages from the web.The returned response is in the structure of a dictionary .For eg: {"":"","label": [ ] ,"torrents": [ ["F0666BDCCBFD01A52535759C044485E2E1CCE3C3",136,"AAA",1250164864,651,646185088,606208,0,0,0,-1,"",0,0,0,0,33564,7,342884352], [

RE: Are there any python jobs worked at home from the internet?

2007-06-11 Thread Doug Phillips
> I know of http://www.rentacoder.com/ but I've never actually used it. http://www.guru.com and http://www.getafreelancer.com are also good sites (in fact I got my current employment starting off as a contractor on guru.com) There are others, but these are the three I've worked with and felt comf

Re: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

2007-06-11 Thread Joachim Durchholz
Twisted schrieb: > On Jun 11, 2:42 am, Joachim Durchholz <[EMAIL PROTECTED]> wrote: >> It is possible to write maintainable Perl. > > Interesting (spoken in the tone of someone hearing about a purported > sighting of Bigfoot, or maybe a UFO). > > Still, extraordinary claims require extraordinary

Re: Are there any python jobs worked at home from the internet?

2007-06-11 Thread kaens
On 6/9/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Sat, 09 Jun 2007 22:53:08 -0300, boyeestudio <[EMAIL PROTECTED]> > escribió: > > > Are there any python jobs worked at home from the internet? > > I want to find a part time job. > > Please give a clue to this for me. > > I know of http:/

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-11 Thread Bruno Desthuilliers
Terry Reedy a écrit : > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | > Terry Reedy wrote: > | > > In Python, you have a choice of recursion (normal or tail) > > [snip Stroud questions] > > | I'm afraid Terry is wrong here, at least if he meant that CPython had > | tail recur

Re: updating db with csv

2007-06-11 Thread Captain Paralytic
On 11 Jun, 07:37, Tim Roberts <[EMAIL PROTECTED]> wrote: | Not in standard SQL. MySQL supports a REPLACE extension that does an | UPDATE if the key already exists, and an INSERT if it does not. There is | also an extension clause to the INSERT statement called "ON DUPLICATE KEY | UPDATE xxx" that

Python Help!!!

2007-06-11 Thread Elfine Peterson Tjio
I'm trying to make a program that reads Fasta file and print it out. I used the SeqIO module and the results is: 'ATGGTCATSingleAlphabet()' For this purpose, should I use SeqIO or Fasta? for example: from Bio import SeqIO or from Bio import Fasta I want it to print every letter. Can any

Regular Text

2007-06-11 Thread jaeltong
Hallo, I am new to python. I wrote a program to retrieve the filepath. eg. C:\Programs\Python\ and write it in a text file It works fine until the path contains \t or \n. eg. C:\Programs\Python \new\. Because of the regular text format, I didn't get what I want in the text file. I tried to change

Re: Regular Text

2007-06-11 Thread Gabriel Genellina
En Mon, 11 Jun 2007 05:53:55 -0300, <[EMAIL PROTECTED]> escribió: > Hallo, > I am new to python. > I wrote a program to retrieve the filepath. eg. C:\Programs\Python\ > and write it in a text file > It works fine until the path contains \t or \n. eg. C:\Programs\Python > \new\. > Because of the re

Re: python-ldap for Python 2.5 on Windows?

2007-06-11 Thread Benedict Verheyen
Waldemar Osuch schreef: > > I have managed to build it for myself using MinGW: > http://www.osuch.org-a.googlepages.com/python-ldap-2.3.win32-py2.5.exe > > See if it will work for you > > Waldemar Hi Waldemar, thanks for the installation file. When i installed it, i got an error stating "The

Postpone creation of attributes until needed

2007-06-11 Thread Frank Millman
Hi all I have a small problem. I have come up with a solution, but I don't know if it is a) safe, and b) optimal. I have a class with a number of attributes, but for various reasons I cannot assign values to all the attributes at __init__ time, as the values depend on attributes of other linked c

Re: python-ldap for Python 2.5 on Windows?

2007-06-11 Thread Thorsten Kampe
* Benedict Verheyen (Mon, 11 Jun 2007 11:23:59 +0200) > Waldemar Osuch schreef: > > I have managed to build it for myself using MinGW: > > http://www.osuch.org-a.googlepages.com/python-ldap-2.3.win32-py2.5.exe > > > > See if it will work for you > > > thanks for the installation file. > When i in

Re: python-ldap for Python 2.5 on Windows?

2007-06-11 Thread Benedict Verheyen
Thorsten Kampe schreef: > * Benedict Verheyen (Mon, 11 Jun 2007 11:23:59 +0200) >> Waldemar Osuch schreef: >>> I have managed to build it for myself using MinGW: >>> http://www.osuch.org-a.googlepages.com/python-ldap-2.3.win32-py2.5.exe >>> >>> See if it will work for you >>> >> thanks for the inst

Re: Regular Text

2007-06-11 Thread jaeltong
Wow, that is fast. Thanks. > In your code, you should use string literals like > > my_path = r"C:\Programs\Python\new" > my_path = "C:\\Programs\\Python\\new" > > But you said "a program to retrieve the filepath" - and I understand that > you dont have a string literal, and you compute it somehow.

Re: Postpone creation of attributes until needed

2007-06-11 Thread Phil Thompson
On Monday 11 June 2007 10:24 am, Frank Millman wrote: > Hi all > > I have a small problem. I have come up with a solution, but I don't > know if it is a) safe, and b) optimal. > > I have a class with a number of attributes, but for various reasons I > cannot assign values to all the attributes at _

Re: Regular Text

2007-06-11 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Wow, that is fast. Thanks. > >> In your code, you should use string literals like >> >> my_path = r"C:\Programs\Python\new" >> my_path = "C:\\Programs\\Python\\new" >> >> But you said "a program to retrieve the filepath" - and I understand that >> you dont have a strin

Re: memory efficient set/dictionary

2007-06-11 Thread koara
> > I would recommend you to use a database since it meets your > > requirements (off-memory, fast, persistent). The bsdddb module > > (berkeley db) even gives you a dictionary like interface. > >http://www.python.org/doc/lib/module-bsddb.html > > Standard SQL databases can work for this, but gener

Re: Postpone creation of attributes until needed

2007-06-11 Thread Steven D'Aprano
On Mon, 11 Jun 2007 02:24:51 -0700, Frank Millman wrote: > Hi all > > I have a small problem. I have come up with a solution, but I don't > know if it is a) safe, and b) optimal. > > I have a class with a number of attributes, but for various reasons I > cannot assign values to all the attribute

Re: Postpone creation of attributes until needed

2007-06-11 Thread Frank Millman
On Jun 11, 11:47 am, Phil Thompson <[EMAIL PROTECTED]> wrote: > On Monday 11 June 2007 10:24 am, Frank Millman wrote: > > > Hi all > > > I have a small problem. I have come up with a solution, but I don't > > know if it is a) safe, and b) optimal. > > > I have a class with a number of attributes, b

Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
Hi all, I have a Python program (on UNIX) whose main job is to listen on a socket, for which I use the SocketServer module. However, I would also like it to be sensitive to signals received, which it isn't if it's listening on the socket. ("signals can only be received between atomic actions of th

Re: Python's "only one way to do it" philosophy isn't good?

2007-06-11 Thread Antoon Pardon
On 2007-06-09, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "WaterWalk" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >| I've just read an article "Building Robust System" by Gerald Jay >| Sussman. The article is here: >| > http://swiss.csail.mit.edu/classes/symbolic/spring07/readin

How to get inputs for a python program that run from another python program

2007-06-11 Thread pradeep nair
I would like to know how to pass keyboard input for a python script which is ran by another script. for eg: hello1.py: import os if __name__=='__main__': print "I will call this other program called hello.py" os.system("python hello.py") print "hello1.py" hello.py: import os

Type error when using SQLAlchemy and Python

2007-06-11 Thread Nathan Harmston
HI, I posted this to sqlalchemy but didnt get a response, so I was wondering if anyone on python-list could help me. I m currently trying to build an api for a database and I really like the way that Djangos manager ( Class_name.objects ) is set up. This seems very intuitive for me. After reading

Re: Postpone creation of attributes until needed

2007-06-11 Thread Frank Millman
On Jun 11, 12:21 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 11 Jun 2007 02:24:51 -0700, Frank Millman wrote: > > Hi all > > > I have a small problem. I have come up with a solution, but I don't > > know if it is a) safe, and b) optimal. > > > I have a class with a number of attributes

netlink messages

2007-06-11 Thread martin f krafft
Dear list, I am writing a daemon in Python that listens on AF_NETLINK and processes RTM_NETLINK messages. FWIW, code is below since there is hardly any reference on the net yet. As you can see from the code, the NETLINK message is all binary/hex. Before I go about wrapping it in a Python class, I

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Stefan Behnel
geoffbache wrote: > I have a Python program (on UNIX) whose main job is to listen on a > socket, for which I use the SocketServer module. However, I would also > like it to be sensitive to signals received, which it isn't if it's > listening on the socket. ("signals can only be received between ato

Re: Postpone creation of attributes until needed

2007-06-11 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Frank Millman wrote: > On Jun 11, 12:21 pm, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> > I use __slots__ to catch any invalid attributes, otherwise I would get >> > a 'maximum recursion depth exceeded' error. >> >> That's the wrong solution to that problem. To avoid th

Re: Postpone creation of attributes until needed

2007-06-11 Thread Steven D'Aprano
On Mon, 11 Jun 2007 03:58:16 -0700, Frank Millman wrote: >> By using slots, you're telling Python not to reserve space for a __dict__, >> which means that your class cannot create attributes on the fly. >> > > I understand that. In fact I was already using slots, as I was > concerned about the nu

Re: Postpone creation of attributes until needed

2007-06-11 Thread Peter Otten
Frank Millman wrote: > I tried that, but I get AttributeError: 'A' object has no attribute > '__dict__'. That's what you get for (ab)using __slots__ without understanding the implications ;) You can instead invoke the __getattr__() method of the superclass: super(A, self).__getattr__(name) Pet

Re: Postpone creation of attributes until needed

2007-06-11 Thread Giles Brown
On 11 Jun, 11:10, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jun 11, 11:47 am, Phil Thompson <[EMAIL PROTECTED]> > wrote: > > > > > On Monday 11 June 2007 10:24 am, Frank Millman wrote: > > > > Hi all > > > > I have a small problem. I have come up with a solution, but I don't > > > know if it is

Re: python-ldap for Python 2.5 on Windows?

2007-06-11 Thread Thorsten Kampe
* Benedict Verheyen (Mon, 11 Jun 2007 11:32:26 +0200) > Thorsten Kampe schreef: > > * Benedict Verheyen (Mon, 11 Jun 2007 11:23:59 +0200) > >> Waldemar Osuch schreef: > >>> I have managed to build it for myself using MinGW: > >>> http://www.osuch.org-a.googlepages.com/python-ldap-2.3.win32-py2.5.ex

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
> Twisted *should* be able to do this, as it uses non-blocking IO. > > http://twistedmatrix.com/trac/ Thanks for the tip. I'll take a look if nobody has any better suggestions. It still seems to me that what I'm trying to do is essentially quite simple, and shouldn't require as large a tool as T

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Jean-Paul Calderone
On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> wrote: > >> Twisted *should* be able to do this, as it uses non-blocking IO. >> >> http://twistedmatrix.com/trac/ > >Thanks for the tip. I'll take a look if nobody has any better >suggestions. Twisted is a pretty good suggestion in

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Chaz Ginger
geoffbache wrote: >> Twisted *should* be able to do this, as it uses non-blocking IO. >> >> http://twistedmatrix.com/trac/ > > Thanks for the tip. I'll take a look if nobody has any better > suggestions. > > It still seems to me that what I'm trying to do is essentially quite > simple, and should

Pasting an image from clipboard in Tkinter?

2007-06-11 Thread exhuma.twn
As many might know, windows allows to copy an image into the clipboard by pressing the "Print Screen" button on the keyboard. Is it possible to paste such an image from the clipboard into a "Text" widget in Tkinter? Here is my first attempt with just trying to print out the image data: ---

Re: Adding tuples to a dictionary

2007-06-11 Thread Maciej Blizi ski
Thank you for all the answers! My problem is solved even better than I expected! @Peter: Yes, the garbage collector was causing the slowdown. Switching it off sped the program up; each iteration was taking the same amount of time. I ran collection manually every 10 iterations to control memory usa

Re: Postpone creation of attributes until needed

2007-06-11 Thread Frank Millman
On Jun 11, 1:56 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > Unless you have thousands and thousands of instances, __slots__ is almost > certainly not the answer. __slots__ is an optimization to minimize the > size of each instance. The fact that it prevents the creation of new > attributes i

Re: python-ldap for Python 2.5 on Windows?

2007-06-11 Thread Benedict Verheyen
Thorsten Kampe schreef: >> I'm on Vista (boohoo :(), what's your platform? > > XP SP2 Hmmm it thought so. So in my case it would be interesting to know how to build it so i can make a build that works on Vista too. Regards, Benedict -- http://mail.python.org/mailman/listinfo/python-list

Re: Are there any python jobs worked at home from the internet?

2007-06-11 Thread Rob Knapp
boyeestudio wrote: > Hi,all buddies. > Are there any python jobs worked at home from the internet? > I want to find a part time job. > Please give a clue to this for me. > Thanks a lot! This is probably going to sound like I'm telling you something you already know, but keep a close eye on the Pyt

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
> > You could probably use the Asyncore stuff to do it as well (with a lot > less stuff). This looked interesting. But it seems the asyncore stuff operates at the socket level, whereas I've currently just got a standard synchronous SocketServer and the socket operations themselves are kind of hid

Re: How to get inputs for a python program that run from another python program

2007-06-11 Thread René Fleschenberg
Hi pradeep nair schrieb: > now wen i run hello1.py,i want the some function or utility in > hello1.py that can pass the keyboard i/p to hello.py . Have a look at subprocess.Popen http://docs.python.org/lib/module-subprocess.html -- René -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
On Jun 11, 2:08 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> wrote: > > >> Twisted *should* be able to do this, as it uses non-blocking IO. > > >>http://twistedmatrix.com/trac/ > > >Thanks for the tip. I'll take a look if no

Re: Postpone creation of attributes until needed

2007-06-11 Thread George Sakkis
On Jun 11, 8:27 am, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jun 11, 1:56 pm, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > > Unless you have thousands and thousands of instances, __slots__ is almost > > certainly not the answer. __slots__ is an optimization to minimize the > > size of ea

Re: Pasting an image from clipboard in Tkinter?

2007-06-11 Thread kyosohma
On Jun 11, 7:23 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > As many might know, windows allows to copy an image into the clipboard > by pressing the "Print Screen" button on the keyboard. Is it possible > to paste such an image from the clipboard into a "Text" widget in > Tkinter? Here is my firs

Re: Python Help!!!

2007-06-11 Thread kyosohma
On Jun 11, 3:39 am, Elfine Peterson Tjio <[EMAIL PROTECTED]> wrote: > I'm trying to make a program that reads Fasta file and print it out. I used > the SeqIO module and the results is: > > 'ATGGTCATSingleAlphabet()' > > For this purpose, should I use SeqIO or Fasta? > > for example: > > from B

wx.grid 2.6.1.0 events

2007-06-11 Thread DarkBlue
Hello pythoncard wx 2.6.1 python 2.4.x kinterbasdb firebird I have a wx.grid filled with data from a database one of the fields is a blob field with text data, which I want to display in some adjacent text control when I scroll through the grid. The question is which wx.EVT_XXX do I need to use

Re: Pasting an image from clipboard in Tkinter?

2007-06-11 Thread exhuma.twn
On Jun 11, 3:47 pm, [EMAIL PROTECTED] wrote: > On Jun 11, 7:23 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > > > > > As many might know, windows allows to copy an image into the clipboard > > by pressing the "Print Screen" button on the keyboard. Is it possible > > to paste such an image from the c

Python-URL! - weekly Python news and links (Jun 11)

2007-06-11 Thread Gabriel Genellina
QOTW: "That's the Martellibot for you. Never use a word where a paragraph with explanatory footnotes will do. Sigh. I miss him on c.l.py." - Simon Brunning "Conclusion: advice to 'try Python for yourself' is apt in a way the original questioner might not realize." - Cameron Laird A

Santa Fe Python Day report

2007-06-11 Thread Facundo Batista
It was very succesful, around +300 people assisted, and there were a lot of interesting talks (two introductory talks, Turbogears, PyWeek, Zope 3, security, creating 3D games, Plone, automatic security testings, concurrency, and programming the OLPC). I want to thanks the PSF for the received s

Re: wx.grid 2.6.1.0 events

2007-06-11 Thread kyosohma
On Jun 11, 9:04 am, DarkBlue <[EMAIL PROTECTED]> wrote: > Hello > > pythoncard > wx 2.6.1 > python 2.4.x > kinterbasdb > firebird > > I have a wx.grid filled with data from a database > one of the fields is a blob field with text data, which > I want to display in some adjacent text control when I

Re: Postpone creation of attributes until needed

2007-06-11 Thread Frank Millman
On Jun 11, 3:38 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 11, 8:27 am, Frank Millman <[EMAIL PROTECTED]> wrote: > > > > Sorry - I made it more explicit above. It is the method that sets up > > all the missing attributes. No matter which attribute is referenced > > first, 'compute' sets

Re: Pasting an image from clipboard in Tkinter?

2007-06-11 Thread kyosohma
On Jun 11, 9:07 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > On Jun 11, 3:47 pm, [EMAIL PROTECTED] wrote: > > > > > On Jun 11, 7:23 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > > > > As many might know, windows allows to copy an image into the clipboard > > > by pressing the "Print Screen" button

skip next item in list

2007-06-11 Thread ahlongxp
list=('a','d','c','d') for a in list: if a=='a' : #skip the letter affer 'a' what am I supposed to do? -- http://mail.python.org/mailman/listinfo/python-list

Re: skip next item in list

2007-06-11 Thread Andre Engels
2007/6/11, ahlongxp <[EMAIL PROTECTED]>: > list=('a','d','c','d') > for a in list: > if a=='a' : > #skip the letter affer 'a' > > what am I supposed to do? There might be better ways to do it, but I would do: flag_last_a = False for a in list: if flag_last_a: flag_last_a = F

with as a reserved word

2007-06-11 Thread BBands
I gather that 'with' is on its way to becoming a reserved word. Is this something that will break? import Gnuplot gp = Gnuplot.Gnuplot(debug=1) data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints') gp.plot(data) >>> :3: Warning: 'with' will become a reserved keyword in Python 2.6 http

Re: with as a reserved word

2007-06-11 Thread kyosohma
On Jun 11, 10:03 am, BBands <[EMAIL PROTECTED]> wrote: > I gather that 'with' is on its way to becoming a reserved word. Is > this something that will break? > > import Gnuplot > gp = Gnuplot.Gnuplot(debug=1) > data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints') > gp.plot(data) > > >>>

Re: skip next item in list

2007-06-11 Thread Diez B. Roggisch
ahlongxp wrote: > list=('a','d','c','d') > for a in list: > if a=='a' : > #skip the letter affer 'a' > > what am I supposed to do? First - don't use list as name, as it is a builtins-name and shadowing is likely to produce errors at some point. list_iterator = iter(('a','d','c','d')

Re: with as a reserved word

2007-06-11 Thread Francesco Guerrieri
Within gnuplot you can shorten "with" to "w", don't know if it can work inside a call to Gnuplot.Data() francesco On 6/11/07, BBands <[EMAIL PROTECTED]> wrote: > I gather that 'with' is on its way to becoming a reserved word. Is > this something that will break? > > import Gnuplot > gp = Gnup

Re: Postpone creation of attributes until needed

2007-06-11 Thread George Sakkis
On Jun 11, 10:37 am, Frank Millman <[EMAIL PROTECTED]> wrote: > On Jun 11, 3:38 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > >The boilerplate code can be minimal too with an appropriate > > decorator, something like: > > > class A(object): > > > def __init__(self,x,y): > > self.x = x

Re: skip next item in list

2007-06-11 Thread [EMAIL PROTECTED]
On Jun 11, 8:49 am, ahlongxp <[EMAIL PROTECTED]> wrote: > list=('a','d','c','d') > for a in list: > if a=='a' : > #skip the letter affer 'a' > > what am I supposed to do? You could do this with itertools.ifilter and an predicate (pred) for a more OO solution. I've created 2 lists, the

Re: Postpone creation of attributes until needed

2007-06-11 Thread Frank Millman
On Jun 11, 5:22 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 11, 10:37 am, Frank Millman <[EMAIL PROTECTED]> wrote: > > > You never *need* decorators, in the sense it's just syntax sugar for > things you might do without them, but they're handy once you get your > head around them. > > > A

Re: skip next item in list

2007-06-11 Thread Rafael Darder Calvo
On 6/11/07, Andre Engels <[EMAIL PROTECTED]> wrote: > 2007/6/11, ahlongxp <[EMAIL PROTECTED]>: > > list=('a','d','c','d') > > for a in list: > > if a=='a' : > > #skip the letter affer 'a' > > > > what am I supposed to do? > > There might be better ways to do it, but I would do: > > flag

Re: skip next item in list

2007-06-11 Thread Duncan Smith
ahlongxp wrote: > list=('a','d','c','d') > for a in list: > if a=='a' : > #skip the letter affer 'a' > > what am I supposed to do? > Maybe, >>> it = iter(['a','d','c','d']) >>> for item in it: print item if item == 'a': x = it.next()

Accessing global namespace from module

2007-06-11 Thread reubendb
Hello, I am new to Python. I have the following question / problem. I have a visualization software with command-line interface (CLI), which essentially is a Python (v. 2.5) interpreter with functions added to the global namespace. I would like to keep my own functions in a separate module and then

Re: Tkinter - resize tkMessageBox

2007-06-11 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, I wondered: >In article <[EMAIL PROTECTED]>, >Glenn Hutchings <[EMAIL PROTECTED]> wrote: >>On 4 Jun, 21:29, [EMAIL PROTECTED] wrote: >>> Is there a way to resize the width of the "tkMessageBox.askyesno" >>> dialog box, so that the text does not wrap to the next line

Re: memory efficient set/dictionary

2007-06-11 Thread Josiah Carlson
koara wrote: >>> I would recommend you to use a database since it meets your >>> requirements (off-memory, fast, persistent). The bsdddb module >>> (berkeley db) even gives you a dictionary like interface. >>> http://www.python.org/doc/lib/module-bsddb.html >> Standard SQL databases can work for th

Re: read 9 bytes

2007-06-11 Thread Grant Edwards
On 2007-06-11, nik <[EMAIL PROTECTED]> wrote: > I need to read a 9 byte response from a device on the serial > port. From reading the pySerial documentation it appears that > I can only read in characters at a time. bytes are the same thing as characters. > If I do: serialport.read(4) > I would

Re: *Naming Conventions*

2007-06-11 Thread Marius Gedminas
On Jun 6, 3:18 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Since 'i' and 'j' are canonically loop indices, I find it > > totally confusing to use them to name the iteration variable - > > which is not an index. > > Certainly i and j are just as generic, but they have the > advantage over 'item'

Re: Repository - file scanner

2007-06-11 Thread HMS Surprise
> > Why not use grep? With Windows XP? jh -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread fumanchu
On Jun 11, 3:34 am, geoffbache <[EMAIL PROTECTED]> wrote: > I have a Python program (on UNIX) whose main job is to listen on a > socket, for which I use the SocketServer module. However, I would also > like it to be sensitive to signals received, which it isn't if it's > listening on the socket. ("

Re: Accessing global namespace from module

2007-06-11 Thread kyosohma
On Jun 11, 11:02 am, reubendb <[EMAIL PROTECTED]> wrote: > Hello, > I am new to Python. I have the following question / problem. > I have a visualization software with command-line interface (CLI), > which essentially is a Python (v. 2.5) interpreter with functions > added to the global namespace.

Re: Repository - file scanner

2007-06-11 Thread jigloo
On 6 9 , 3 33 , HMS Surprise <[EMAIL PROTECTED]> wrote: > Greetings, > > Could someone point my muddled head at a/the python repository. I know > that one exists but cannot find it again. In particular I am looking > for a standalone search tool that given a path searches files for a > text strin

Re: Python optimization (was Python's "only one way to do it" philosophy isn't good?)

2007-06-11 Thread John Nagle
Diez B. Roggisch wrote: > Regardless of the possibility of speeding it up - why should one want > this? Coding speed is more important than speed of coding in 90%+ of all > cases. When you have to start buying more servers for the server farm, it's a real pain. I'm actually facing that be

Re: *Naming Conventions*

2007-06-11 Thread Neil Cerutti
On 2007-06-11, Marius Gedminas <[EMAIL PROTECTED]> wrote: > On Jun 6, 3:18 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> > Since 'i' and 'j' are canonically loop indices, I find it >> > totally confusing to use them to name the iteration variable - >> > which is not an index. >> >> Certainly i and

RE: Accessing global namespace from module

2007-06-11 Thread John Krukoff
On Jun 11, 11:02 am, reubendb <[EMAIL PROTECTED]> wrote: > Hello, > I am new to Python. I have the following question / problem. > I have a visualization software with command-line interface (CLI), > which essentially is a Python (v. 2.5) interpreter with functions > added to the global namespace.

Re: Accessing global namespace from module

2007-06-11 Thread reubendb
On Jun 11, 1:37 pm, [EMAIL PROTECTED] wrote: > On Jun 11, 11:02 am, reubendb <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > I am new to Python. I have the following question / problem. > > I have a visualization software with command-line interface (CLI), > > which essentially is a Python (v. 2.5)

REALLY need help with iterating a list.

2007-06-11 Thread Radamand
This has been driving me buggy for 2 days, i need to be able to iterate a list of items until none are left, without regard to which items are removed. I'll put the relevant portions of code below, please forgive my attrocious naming conventions. Basically i'm trying to spin up some subproc

Re: with as a reserved word

2007-06-11 Thread Fredrik Lundh
BBands wrote: > I gather that 'with' is on its way to becoming a reserved word. Is > this something that will break? yes. > import Gnuplot > gp = Gnuplot.Gnuplot(debug=1) > data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints') if you have Python 2.5, you can try it out yourself: >>

Re: REALLY need help with iterating a list.

2007-06-11 Thread alg
Reverse iteration should do the trick, if I understand your problem: for server in reversed(serverlist): ... else: serverlist.remove(server) On Jun 11, 11:30 am, Radamand <[EMAIL PROTECTED]> wrote: > This has been driving me buggy for 2 days, i need to be able to > iterate a l

Re: Python for embedded systems with memory constraints

2007-06-11 Thread vishnu
Hello, Using the best fit for Python will not be a problem, because Python makes allocations of lot of small size blocks.So those split blocks of small sizes are used by Python sometime. And what I observed from my investigation with the memory manager(MM) for Python is , with any MM we cannot el

Re: Repository - file scanner

2007-06-11 Thread HMS Surprise
Thank you all. jh -- http://mail.python.org/mailman/listinfo/python-list

Re: REALLY need help with iterating a list.

2007-06-11 Thread infidel
On Jun 11, 11:30 am, Radamand <[EMAIL PROTECTED]> wrote: > This has been driving me buggy for 2 days, i need to be able to > iterate a list of items until none are left, without regard to which > items are removed. I'll put the relevant portions of code below, > please forgive my attrocious nam

Re: Repository - file scanner

2007-06-11 Thread Paul Rudin
HMS Surprise <[EMAIL PROTECTED]> writes: >> >> Why not use grep? > > With Windows XP? www.cygwin.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Repository - file scanner

2007-06-11 Thread John Machin
On Jun 12, 4:46 am, Paul Rudin <[EMAIL PROTECTED]> wrote: > HMS Surprise <[EMAIL PROTECTED]> writes: > > >> Why not use grep? > > > With Windows XP? > > www.cygwin.com Using cygwin for this problem is like using a sledgehammer to crack a nut. See http://gnuwin32.sourceforge.net/summary.html *Lots

Re: with as a reserved word

2007-06-11 Thread BBands
On Jun 11, 11:34 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > if you have Python 2.5, you can try it out yourself: > > >>> dict(with=1) > :1: Warning: 'with' will become a reserved keyword in Python 2.6 > {'with': 1} > > >>> from __future__ import with_statement > >>> dict(with=1) >File ""

Re: REALLY need help with iterating a list.

2007-06-11 Thread Fredrik Lundh
infidel wrote: > How about something like this? > > while serverlist: > server = serverlist.pop(0) > pinger = ping[server] > if pinger.returncode==None: > pinger.poll() > serverlist.append(server) > else: > pingresult[server] = pinger.stdout.read() >

Re: Accessing global namespace from module

2007-06-11 Thread Gabriel Genellina
En Mon, 11 Jun 2007 15:18:58 -0300, reubendb <[EMAIL PROTECTED]> escribió: > The problem is I don't define the functions AddPlot() and DrawPlots(). > It's built into the python interpreter of the CLI version of the > program I mentioned, and they are defined on the main script. I load > the main s

Re: Postpone creation of attributes until needed

2007-06-11 Thread Steven Bethard
George Sakkis wrote: > On Jun 11, 8:27 am, Frank Millman <[EMAIL PROTECTED]> wrote: >> On Jun 11, 1:56 pm, Steven D'Aprano >> >> <[EMAIL PROTECTED]> wrote: >> >>> Unless you have thousands and thousands of instances, __slots__ is almost >>> certainly not the answer. __slots__ is an optimization to

Re: Repository - file scanner

2007-06-11 Thread Gabriel Genellina
En Mon, 11 Jun 2007 15:46:51 -0300, Paul Rudin <[EMAIL PROTECTED]> escribió: > HMS Surprise <[EMAIL PROTECTED]> writes: >>> >>> Why not use grep? >> >> With Windows XP? > > www.cygwin.com Why? Try findstr /? at the command prompt. -- Gabriel Genellina -- http://mail.python.org/mailman/listi

Re: with as a reserved word

2007-06-11 Thread Fredrik Lundh
BBands wrote: > I don't have an opinion, pro or con, on this PEP, but I'll bet that it > breaks a lot of code. that's why you get warnings in 2.5, so you have time to update your code; see: http://www.python.org/dev/peps/pep-0005/ estimating what "a lot" is isn't trivial, but it's worth n

Re: REALLY need help with iterating a list.

2007-06-11 Thread Radamand
On Jun 11, 1:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > infidel wrote: > > How about something like this? > > > while serverlist: > > server = serverlist.pop(0) > > pinger = ping[server] > > if pinger.returncode==None: > > pinger.poll() > > serverlist.append(serve

Link Dictionary

2007-06-11 Thread anush shetty
Hi, I have two dictionaries dict1={'B8': set(['I8', 'H8', 'B2', 'B7', 'F8', 'C9', 'G8', 'B4', 'B5', 'B6', 'C8', 'E8', 'D8', 'B3', 'A9', 'A8', 'C7', 'B9', 'A7', 'B1']), 'B9': set(['I9', 'H9', 'A7', 'F9', 'B3', 'B6', 'G9', 'B4', 'B5', 'C9', 'B7', 'E9', 'B1', 'B2', 'D9', 'A9', 'A8', 'C8', 'B8', 'C7'

ANN: papyros 0.1

2007-06-11 Thread George Sakkis
I am pleased to announce the first alpha release of Papyros, a lightweight platform-independent package for parallel processing. Papyros provides a master-slave model: clients can submit jobs to a master object which is monitored by one or more slave objects that do the real work. Two main implemen

ANN: xlrd 0.6.1 final is now available

2007-06-11 Thread John Machin
The final release of version 0.6.1 of xlrd is now available from http://www.lexicon.net/sjmachin/xlrd.htm and from the Cheeseshop (http://cheeseshop.python.org/pypi/xlrd). What is xlrd? It's a small (download approx 0.1 Mb) pure-Python library for extracting information from Microsoft Excel (tm)

Re: REALLY need help with iterating a list.

2007-06-11 Thread Radamand
On Jun 11, 12:59 pm, infidel <[EMAIL PROTECTED]> wrote: > On Jun 11, 11:30 am, Radamand <[EMAIL PROTECTED]> wrote: > > > > > This has been driving me buggy for 2 days, i need to be able to > > iterate a list of items until none are left, without regard to which > > items are removed. I'll put t

Re: Accessing global namespace from module

2007-06-11 Thread reubendb
On Jun 11, 3:30 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 11 Jun 2007 15:18:58 -0300, reubendb <[EMAIL PROTECTED]> escribió: > > > The problem is I don't define the functions AddPlot() and DrawPlots(). > > It's built into the python interpreter of the CLI version of the > > progr

  1   2   >